Removing possible calls to Object#to_a.

master
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

@ -1,13 +1,18 @@
=== Net::LDAP NEXT / 2010-__-__
* Extending unit testing:
* Added documentation:
* Core class extension methods under Net::BER.
* Extended unit testing:
* Added some unit tests for the BER core extensions.
* Code clean-up:
* Replaced calls to #to_a with calls to Kernel#Array; since Ruby 1.8.3, the
default #to_a implementation has been deprecated and should be replaced
either with calls to Kernel#Array or [value].flatten(1).
* SSL capabilities will be enabled or disabled based on whether we can load
OpenSSL successfully or not.
* Moved the core class extensions extensions from being in the Net::LDAP
hierarchy to the Net::BER hierarchy as most of the methods therein are
related to BER-encoding values. This will make extracting Net::BER from
Net::LDAP easier in the future.
* Documented the core class extension methods.
=== Net::LDAP 0.1.1 / 2010-03-18
* Fixing a critical problem with sockets.

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}" )