# File lib/active_ldap/xml.rb, line 11 def initialize(dn, attributes, schema, options={}) @dn = dn @attributes = attributes @schema = schema @options = options end
# File lib/active_ldap/xml.rb, line 18 def to_s root = @options[:root] indent = @options[:indent] || 2 xml = @options[:builder] || Builder::XmlMarkup.new(:indent => indent) xml.tag!(root) do target_attributes.each do |key, values| values = normalize_values(values).sort_by {|value, _| value} if @schema.attribute(key).single_value? next if values.empty? serialize_attribute_value(xml, key, *values[0]) else serialize_attribute_values(xml, key, values) end end end end