Treequel::Filter::

SubstringItemComponent

class
Superclass
Treequel::Filter::ItemComponent
Included Modules
Treequel::Constants::Patterns

A 'substring' (attribute=foo*) component

Attributes

attribute[RW]

The name of the attribute to match against

options[RW]

The attribute options

pattern[RW]

The pattern to match (if the index exists in the directory)

Public Class Methods

anchor
new( attribute, pattern, options=nil )

Create a new 'substring' item filter component that will match the specified pattern against the given attribute.

# File lib/treequel/filter.rb, line 349
def initialize( attribute, pattern, options=nil )
        @attribute = attribute
        @pattern   = pattern
        @options   = options

        super()
end
anchor
parse_from_string( literal )

Parse the substring item from the given literal.

# File lib/treequel/filter.rb, line 333
def self::parse_from_string( literal )
        match = LDAP_SUBSTRING_FILTER.match( literal ) or
                raise Treequel::ExpressionError,
                        "unable to parse %p as a substring literal" % [ literal ]

        self.log.debug "  parsed substring literal as: %p" % [ match.captures ]
        return self.new( *(match.captures.values_at(1,3,2)) )
end

Public Instance Methods

anchor
to_s()

Stringify the component

# File lib/treequel/filter.rb, line 373
def to_s
        return self.attribute.to_s + self.options.to_s + '=' + self.pattern
end