Removing possible calls to Object#to_a.

This commit is contained in:
Austin Ziegler 2010-03-20 23:08:22 -04:00 committed by Kaspar Schiess
parent 7c3f2427a0
commit afe43a5e58
3 changed files with 10 additions and 5 deletions

View file

@ -1502,7 +1502,7 @@ module Net
# TODO, fix the following line, which gives a bogus error
# if the opcode is invalid.
op_1 = {:add => 0, :delete => 1, :replace => 2} [op.to_sym].to_ber_enumerated
modify_ops << [op_1, [attr.to_s.to_ber, values.to_a.map {|v| v.to_ber}.to_ber_set].to_ber_sequence].to_ber_sequence
modify_ops << [op_1, [attr.to_s.to_ber, Array(values).map {|v| v.to_ber}.to_ber_set].to_ber_sequence].to_ber_sequence
}
request = [modify_dn.to_ber, modify_ops.to_ber_sequence].to_ber_appsequence(6)
@ -1525,7 +1525,7 @@ module Net
add_dn = args[:dn] or raise LdapError.new("Unable to add empty DN")
add_attrs = []
a = args[:attributes] and a.each {|k,v|
add_attrs << [ k.to_s.to_ber, v.to_a.map {|m| m.to_ber}.to_ber_set ].to_ber_sequence
add_attrs << [ k.to_s.to_ber, Array(v).map {|m| m.to_ber}.to_ber_set ].to_ber_sequence
}
request = [add_dn.to_ber, add_attrs.to_ber_sequence].to_ber_appsequence(8)

View file

@ -376,7 +376,7 @@ class Filter
if @right == "*"
l = entry[@left] and l.length > 0
else
l = entry[@left] and l = l.to_a and l.index(@right)
l = entry[@left] and l = Array(l) and l.index(@right)
end
else
raise LdapError.new( "unknown filter type in match: #{@op}" )