class Treequel::Filter::SubstringItemComponent

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

new( attribute, pattern, options=nil ) click to toggle source

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

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

        super()
end
parse_from_string( literal ) click to toggle source

Parse the substring item from the given literal.

# File lib/treequel/filter.rb, line 321
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 ]

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

Public Instance Methods

to_s() click to toggle source

Stringify the component

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