Skip to content

Commit afe43a5

Browse files
Austin Zieglerkschiess
authored andcommitted
Removing possible calls to Object#to_a.
1 parent 7c3f242 commit afe43a5

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

History.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
=== Net::LDAP NEXT / 2010-__-__
2-
* Extending unit testing:
2+
* Added documentation:
3+
* Core class extension methods under Net::BER.
4+
* Extended unit testing:
35
* Added some unit tests for the BER core extensions.
6+
* Code clean-up:
7+
* Replaced calls to #to_a with calls to Kernel#Array; since Ruby 1.8.3, the
8+
default #to_a implementation has been deprecated and should be replaced
9+
either with calls to Kernel#Array or [value].flatten(1).
410
* SSL capabilities will be enabled or disabled based on whether we can load
511
OpenSSL successfully or not.
612
* Moved the core class extensions extensions from being in the Net::LDAP
713
hierarchy to the Net::BER hierarchy as most of the methods therein are
814
related to BER-encoding values. This will make extracting Net::BER from
915
Net::LDAP easier in the future.
10-
* Documented the core class extension methods.
1116

1217
=== Net::LDAP 0.1.1 / 2010-03-18
1318
* Fixing a critical problem with sockets.

lib/net/ldap.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,7 +1502,7 @@ def modify args
15021502
# TODO, fix the following line, which gives a bogus error
15031503
# if the opcode is invalid.
15041504
op_1 = {:add => 0, :delete => 1, :replace => 2} [op.to_sym].to_ber_enumerated
1505-
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
1505+
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
15061506
}
15071507

15081508
request = [modify_dn.to_ber, modify_ops.to_ber_sequence].to_ber_appsequence(6)
@@ -1525,7 +1525,7 @@ def add args
15251525
add_dn = args[:dn] or raise LdapError.new("Unable to add empty DN")
15261526
add_attrs = []
15271527
a = args[:attributes] and a.each {|k,v|
1528-
add_attrs << [ k.to_s.to_ber, v.to_a.map {|m| m.to_ber}.to_ber_set ].to_ber_sequence
1528+
add_attrs << [ k.to_s.to_ber, Array(v).map {|m| m.to_ber}.to_ber_set ].to_ber_sequence
15291529
}
15301530

15311531
request = [add_dn.to_ber, add_attrs.to_ber_sequence].to_ber_appsequence(8)

lib/net/ldap/filter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ def match entry
376376
if @right == "*"
377377
l = entry[@left] and l.length > 0
378378
else
379-
l = entry[@left] and l = l.to_a and l.index(@right)
379+
l = entry[@left] and l = Array(l) and l.index(@right)
380380
end
381381
else
382382
raise LdapError.new( "unknown filter type in match: #{@op}" )

0 commit comments

Comments
 (0)