Class: Treequel::Filter::PresentItemComponent

Inherits:
ItemComponent show all
Defined in:
lib/treequel/filter.rb

Overview

A ‘present’ (attribute=*) component

Constant Summary collapse

DEFAULT_ATTRIBUTE =

The default attribute to test for presence if none is specified

:objectClass

Instance Method Summary collapse

Methods inherited from Component

inherited, #inspect

Constructor Details

#initialize(attribute = DEFAULT_ATTRIBUTE) ⇒ PresentItemComponent

Create a new ‘presence’ item filter component for the given attribute.



308
309
310
# File 'lib/treequel/filter.rb', line 308

def initialize( attribute=DEFAULT_ATTRIBUTE )
  @attribute = attribute
end

Instance Method Details

#promiscuous?Boolean

Returns true, indicating that this component in a filter will match every entry if its attribute is ‘objectClass’.

Returns:

  • (Boolean)


321
322
323
# File 'lib/treequel/filter.rb', line 321

def promiscuous?
  return @attribute.to_sym == DEFAULT_ATTRIBUTE
end

#to_sObject

Stringify the component



314
315
316
# File 'lib/treequel/filter.rb', line 314

def to_s
  return @attribute.to_s + '=*'
end