lib/net/ldap/dataset.rb in net-ldap-0.13.0 vs lib/net/ldap/dataset.rb in net-ldap-0.14.0

- old
+ new

@@ -27,11 +27,11 @@ ary += @comments unless @comments.empty? keys.sort.each do |dn| ary << "dn: #{dn}" - attributes = self[dn].keys.map { |attr| attr.to_s }.sort + attributes = self[dn].keys.map(&:to_s).sort attributes.each do |attr| self[dn][attr.to_sym].each do |value| if attr == "userpassword" or value_is_binary?(value) value = [value].pack("m").chomp.gsub(/\n/m, "\n ") ary << "#{attr}:: #{value}" @@ -139,10 +139,10 @@ elsif line =~ /^dn:([\:]?)[\s]*/i # $1 is a colon if the dn-value is base-64 encoded # $' is the dn-value # Avoid the Base64 class because not all Ruby versions have it. dn = ($1 == ":") ? $'.unpack('m').shift : $' - ds[dn] = Hash.new { |k,v| k[v] = [] } + ds[dn] = Hash.new { |k, v| k[v] = [] } yield :dn, dn if block_given? elsif line.empty? dn = nil yield :end, nil if block_given? elsif line =~ /^([^:]+):([\:]?)[\s]*/