Class: Net::LDAP::Filter::FilterParser

Inherits:
Object
  • Object
show all
Defined in:
lib/net/ldap/filter.rb

Overview

Parses RFC 2254-style string representations of LDAP filters into Filter object hierarchies.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str) ⇒ FilterParser

Returns a new instance of FilterParser.



652
653
654
655
656
# File 'lib/net/ldap/filter.rb', line 652

def initialize(str)
  require 'strscan' # Don't load strscan until we need it.
  @filter = parse(StringScanner.new(str))
  raise Net::LDAP::LdapError, "Invalid filter syntax." unless @filter
end

Instance Attribute Details

#filterObject (readonly)

The constructed filter.



640
641
642
# File 'lib/net/ldap/filter.rb', line 640

def filter
  @filter
end

Class Method Details

.parse(ldap_filter_string) ⇒ Object

Construct a filter tree from the provided string and return it.



647
648
649
# File 'lib/net/ldap/filter.rb', line 647

def parse(ldap_filter_string)
  new(ldap_filter_string).filter
end