Method: Net::LDAP::Filter.parse_ldap_filter

Defined in:
lib/net/ldap/filter.rb

.parse_ldap_filter(obj) ⇒ Object

– We get a Ruby object which comes from parsing an RFC-1777 “Filter” object. Convert it to a Net::LDAP::Filter. TODO, we’re hardcoding the RFC-1777 BER-encodings of the various filter types. Could pull them out into a constant.


251
252
253
254
255
256
257
258
259
260
# File 'lib/net/ldap/filter.rb', line 251

def Filter::parse_ldap_filter obj
  case obj.ber_identifier
  when 0x87         # present. context-specific primitive 7.
    Filter.eq( obj.to_s, "*" )
  when 0xa3         # equalityMatch. context-specific constructed 3.
    Filter.eq( obj[0], obj[1] )
  else
    raise LdapError.new( "unknown ldap search-filter type: #{obj.ber_identifier}" )
  end
end