Class: LDAP::Filter::Base

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, value, inverse = false) ⇒ Base

Returns a new instance of Base.



6
7
8
9
10
# File 'lib/ldap/filter/base.rb', line 6

def initialize key, value, inverse=false
  @key = key
  @value = value.to_s
  @not = inverse
end

Instance Attribute Details

#keyObject

Returns the value of attribute key.



4
5
6
# File 'lib/ldap/filter/base.rb', line 4

def key
  @key
end

#valueObject

Returns the value of attribute value.



4
5
6
# File 'lib/ldap/filter/base.rb', line 4

def value
  @value
end

Instance Method Details

#!Object



19
20
21
22
# File 'lib/ldap/filter/base.rb', line 19

def !
  @not = !@not
  self
end

#&(filter) ⇒ Object



32
33
34
# File 'lib/ldap/filter/base.rb', line 32

def & filter
  AndFilter.new [self, filter]
end

#<<(value) ⇒ Object



24
25
26
# File 'lib/ldap/filter/base.rb', line 24

def << value
  OrFilter.new @key, @value, value
end

#to_sObject



12
13
14
15
16
17
# File 'lib/ldap/filter/base.rb', line 12

def to_s
  filter = '('
  filter << '!' if @not
  filter << condition
  filter << ')'
end

#|(filter) ⇒ Object



28
29
30
# File 'lib/ldap/filter/base.rb', line 28

def | filter
  OrFilter.new [self, filter]
end