File tree 8 files changed +10
-24
lines changed
8 files changed +10
-24
lines changed Original file line number Diff line number Diff line change @@ -578,20 +578,6 @@ Style/SpecialGlobalVars:
578
578
Style/StringLiterals :
579
579
Enabled : false
580
580
581
- # Offense count: 11
582
- # Cop supports --auto-correct.
583
- # Configuration parameters: IgnoredMethods.
584
- Style/SymbolProc :
585
- Exclude :
586
- - ' lib/net/ber.rb'
587
- - ' lib/net/ber/core_ext/array.rb'
588
- - ' lib/net/ldap/connection.rb'
589
- - ' lib/net/ldap/dataset.rb'
590
- - ' lib/net/ldap/filter.rb'
591
- - ' test/ber/test_ber.rb'
592
- - ' test/test_ldif.rb'
593
- - ' testserver/ldapserver.rb'
594
-
595
581
# Offense count: 5
596
582
# Cop supports --auto-correct.
597
583
Style/UnneededPercentQ :
Original file line number Diff line number Diff line change @@ -270,7 +270,7 @@ class Net::BER::BerIdentifiedOid
270
270
271
271
def initialize ( oid )
272
272
if oid . is_a? ( String )
273
- oid = oid . split ( /\. / ) . map { | s | s . to_i }
273
+ oid = oid . split ( /\. / ) . map ( & : to_i)
274
274
end
275
275
@value = oid
276
276
end
Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ def to_ber_control
89
89
#if our array does not contain at least one array then wrap it in an array before going forward
90
90
ary = self [ 0 ] . kind_of? ( Array ) ? self : [ self ]
91
91
ary = ary . collect do |control_sequence |
92
- control_sequence . collect { | element | element . to_ber } . to_ber_sequence . reject_empty_ber_arrays
92
+ control_sequence . collect ( & : to_ber) . to_ber_sequence . reject_empty_ber_arrays
93
93
end
94
94
ary . to_ber_sequence . reject_empty_ber_arrays
95
95
end
Original file line number Diff line number Diff line change @@ -409,7 +409,7 @@ def search(args = nil)
409
409
Net ::LDAP ::LDAPControls ::PAGED_RESULTS . to_ber ,
410
410
# Criticality MUST be false to interoperate with normal LDAPs.
411
411
false . to_ber ,
412
- rfc2696_cookie . map { | v | v . to_ber } . to_ber_sequence . to_s . to_ber ,
412
+ rfc2696_cookie . map ( & : to_ber) . to_ber_sequence . to_s . to_ber ,
413
413
] . to_ber_sequence if paged
414
414
controls << ber_sort if ber_sort
415
415
controls = controls . empty? ? nil : controls . to_ber_contextspecific ( 0 )
@@ -604,7 +604,7 @@ def add(args)
604
604
add_dn = args [ :dn ] or raise Net ::LDAP ::EmptyDNError , "Unable to add empty DN"
605
605
add_attrs = [ ]
606
606
a = args [ :attributes ] and a . each do |k , v |
607
- add_attrs << [ k . to_s . to_ber , Array ( v ) . map { | m | m . to_ber } . to_ber_set ] . to_ber_sequence
607
+ add_attrs << [ k . to_s . to_ber , Array ( v ) . map ( & : to_ber) . to_ber_set ] . to_ber_sequence
608
608
end
609
609
610
610
message_id = next_msgid
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ def to_ldif
29
29
keys . sort . each do |dn |
30
30
ary << "dn: #{ dn } "
31
31
32
- attributes = self [ dn ] . keys . map { | attr | attr . to_s } . sort
32
+ attributes = self [ dn ] . keys . map ( & : to_s) . sort
33
33
attributes . each do |attr |
34
34
self [ dn ] [ attr . to_sym ] . each do |value |
35
35
if attr == "userpassword" or value_is_binary? ( value )
Original file line number Diff line number Diff line change @@ -550,10 +550,10 @@ def to_ber
550
550
[ self . class . eq ( @left , @right ) . to_ber ] . to_ber_contextspecific ( 2 )
551
551
when :and
552
552
ary = [ @left . coalesce ( :and ) , @right . coalesce ( :and ) ] . flatten
553
- ary . map { | a | a . to_ber } . to_ber_contextspecific ( 0 )
553
+ ary . map ( & : to_ber) . to_ber_contextspecific ( 0 )
554
554
when :or
555
555
ary = [ @left . coalesce ( :or ) , @right . coalesce ( :or ) ] . flatten
556
- ary . map { | a | a . to_ber } . to_ber_contextspecific ( 1 )
556
+ ary . map ( & : to_ber) . to_ber_contextspecific ( 1 )
557
557
when :not
558
558
[ @left . to_ber ] . to_ber_contextspecific ( 2 )
559
559
end
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ def test_empty_array
7
7
8
8
def test_array
9
9
ary = [ 1 , 2 , 3 ]
10
- encoded_ary = ary . map { | el | el . to_ber } . to_ber
10
+ encoded_ary = ary . map ( & : to_ber) . to_ber
11
11
12
12
assert_equal ary , encoded_ary . read_ber
13
13
end
Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ def handle_search_request pdu
119
119
# pdu[1][7] is the list of requested attributes.
120
120
# If it's an empty array, that means that *all* attributes were requested.
121
121
requested_attrs = if pdu [ 1 ] [ 7 ] . length > 0
122
- pdu [ 1 ] [ 7 ] . map { | a | a . downcase }
122
+ pdu [ 1 ] [ 7 ] . map ( & : downcase)
123
123
else
124
124
:all
125
125
end
@@ -138,7 +138,7 @@ def handle_search_request pdu
138
138
attrs = [ ]
139
139
entry . each do |k , v |
140
140
if requested_attrs == :all or requested_attrs . include? ( k . downcase )
141
- attrvals = v . map { | v1 | v1 . to_ber } . to_ber_set
141
+ attrvals = v . map ( & : to_ber) . to_ber_set
142
142
attrs << [ k . to_ber , attrvals ] . to_ber_sequence
143
143
end
144
144
end
You can’t perform that action at this time.
0 commit comments