Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix symbol proc #255

Merged
merged 1 commit into from
Jan 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -578,20 +578,6 @@ Style/SpecialGlobalVars:
Style/StringLiterals:
Enabled: false

# Offense count: 11
# Cop supports --auto-correct.
# Configuration parameters: IgnoredMethods.
Style/SymbolProc:
Exclude:
- 'lib/net/ber.rb'
- 'lib/net/ber/core_ext/array.rb'
- 'lib/net/ldap/connection.rb'
- 'lib/net/ldap/dataset.rb'
- 'lib/net/ldap/filter.rb'
- 'test/ber/test_ber.rb'
- 'test/test_ldif.rb'
- 'testserver/ldapserver.rb'

# Offense count: 5
# Cop supports --auto-correct.
Style/UnneededPercentQ:
Expand Down
2 changes: 1 addition & 1 deletion lib/net/ber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ class Net::BER::BerIdentifiedOid

def initialize(oid)
if oid.is_a?(String)
oid = oid.split(/\./).map {|s| s.to_i }
oid = oid.split(/\./).map(&:to_i)
end
@value = oid
end
Expand Down
2 changes: 1 addition & 1 deletion lib/net/ber/core_ext/array.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def to_ber_control
#if our array does not contain at least one array then wrap it in an array before going forward
ary = self[0].kind_of?(Array) ? self : [self]
ary = ary.collect do |control_sequence|
control_sequence.collect{|element| element.to_ber}.to_ber_sequence.reject_empty_ber_arrays
control_sequence.collect(&:to_ber).to_ber_sequence.reject_empty_ber_arrays
end
ary.to_ber_sequence.reject_empty_ber_arrays
end
Expand Down
4 changes: 2 additions & 2 deletions lib/net/ldap/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ def search(args = nil)
Net::LDAP::LDAPControls::PAGED_RESULTS.to_ber,
# Criticality MUST be false to interoperate with normal LDAPs.
false.to_ber,
rfc2696_cookie.map{ |v| v.to_ber}.to_ber_sequence.to_s.to_ber,
rfc2696_cookie.map(&:to_ber).to_ber_sequence.to_s.to_ber,
].to_ber_sequence if paged
controls << ber_sort if ber_sort
controls = controls.empty? ? nil : controls.to_ber_contextspecific(0)
Expand Down Expand Up @@ -604,7 +604,7 @@ def add(args)
add_dn = args[:dn] or raise Net::LDAP::EmptyDNError, "Unable to add empty DN"
add_attrs = []
a = args[:attributes] and a.each do |k, v|
add_attrs << [k.to_s.to_ber, Array(v).map { |m| m.to_ber}.to_ber_set].to_ber_sequence
add_attrs << [k.to_s.to_ber, Array(v).map(&:to_ber).to_ber_set].to_ber_sequence
end

message_id = next_msgid
Expand Down
2 changes: 1 addition & 1 deletion lib/net/ldap/dataset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def to_ldif
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)
Expand Down
4 changes: 2 additions & 2 deletions lib/net/ldap/filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -550,10 +550,10 @@ def to_ber
[self.class.eq(@left, @right).to_ber].to_ber_contextspecific(2)
when :and
ary = [@left.coalesce(:and), @right.coalesce(:and)].flatten
ary.map {|a| a.to_ber}.to_ber_contextspecific(0)
ary.map(&:to_ber).to_ber_contextspecific(0)
when :or
ary = [@left.coalesce(:or), @right.coalesce(:or)].flatten
ary.map {|a| a.to_ber}.to_ber_contextspecific(1)
ary.map(&:to_ber).to_ber_contextspecific(1)
when :not
[@left.to_ber].to_ber_contextspecific(2)
end
Expand Down
2 changes: 1 addition & 1 deletion test/ber/test_ber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def test_empty_array

def test_array
ary = [1, 2, 3]
encoded_ary = ary.map { |el| el.to_ber }.to_ber
encoded_ary = ary.map(&:to_ber).to_ber

assert_equal ary, encoded_ary.read_ber
end
Expand Down
4 changes: 2 additions & 2 deletions testserver/ldapserver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def handle_search_request pdu
# pdu[1][7] is the list of requested attributes.
# If it's an empty array, that means that *all* attributes were requested.
requested_attrs = if pdu[1][7].length > 0
pdu[1][7].map {|a| a.downcase}
pdu[1][7].map(&:downcase)
else
:all
end
Expand All @@ -138,7 +138,7 @@ def handle_search_request pdu
attrs = []
entry.each do |k, v|
if requested_attrs == :all or requested_attrs.include?(k.downcase)
attrvals = v.map {|v1| v1.to_ber}.to_ber_set
attrvals = v.map(&:to_ber).to_ber_set
attrs << [k.to_ber, attrvals].to_ber_sequence
end
end
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.