Skip to content

Commit 17607c6

Browse files
indent file, and use multiple conditions in one line
1 parent 210585e commit 17607c6

File tree

1 file changed

+20
-22
lines changed

1 file changed

+20
-22
lines changed

lib/net/ldap/filter.rb

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,22 @@ def eq(attribute, value)
6565
new(:eq, attribute, value)
6666
end
6767

68-
##
69-
# Creates a Filter object indicating a binary comparison.
70-
# this prevents the search data from being forced into a UTF-8 string.
71-
#
72-
# This is primarily used for Microsoft Active Directory to compare
73-
# GUID values.
74-
#
75-
# # for guid represented as hex charecters
76-
# guid = "6a31b4a12aa27a41aca9603f27dd5116"
77-
# guid_bin = [guid].pack("H*")
78-
# f = Net::LDAP::Filter.bineq("objectGUID", guid_bin)
79-
#
80-
# This filter does not perform any escaping.
81-
def bineq(attribute, value)
82-
new(:bineq, attribute, value)
83-
end
68+
##
69+
# Creates a Filter object indicating a binary comparison.
70+
# this prevents the search data from being forced into a UTF-8 string.
71+
#
72+
# This is primarily used for Microsoft Active Directory to compare
73+
# GUID values.
74+
#
75+
# # for guid represented as hex charecters
76+
# guid = "6a31b4a12aa27a41aca9603f27dd5116"
77+
# guid_bin = [guid].pack("H*")
78+
# f = Net::LDAP::Filter.bineq("objectGUID", guid_bin)
79+
#
80+
# This filter does not perform any escaping.
81+
def bineq(attribute, value)
82+
new(:bineq, attribute, value)
83+
end
8484

8585
##
8686
# Creates a Filter object indicating extensible comparison. This Filter
@@ -414,10 +414,8 @@ def to_raw_rfc2254
414414
case @op
415415
when :ne
416416
"!(#{@left}=#{@right})"
417-
when :eq
417+
when :eq, :bineq
418418
"#{@left}=#{@right}"
419-
when :bineq
420-
"#{@left}=#{@right}"
421419
when :ex
422420
"#{@left}:=#{@right}"
423421
when :ge
@@ -527,9 +525,9 @@ def to_ber
527525
else # equality
528526
[@left.to_s.to_ber, unescape(@right).to_ber].to_ber_contextspecific(3)
529527
end
530-
when :bineq
531-
# make sure data is not forced to UTF-8
532-
[@left.to_s.to_ber, unescape(@right).to_ber_bin].to_ber_contextspecific(3)
528+
when :bineq
529+
# make sure data is not forced to UTF-8
530+
[@left.to_s.to_ber, unescape(@right).to_ber_bin].to_ber_contextspecific(3)
533531
when :ex
534532
seq = []
535533

0 commit comments

Comments
 (0)