Class: Ldaptic::Filter::Abstract

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

Overview

The filter class from which all others derive.

Direct Known Subclasses

Array, Attribute, Hash, Join, Not, Pair, String

Instance Method Summary collapse

Instance Method Details

#&(other) ⇒ Object

Combine two filters with a logical AND.



42
43
44
# File 'lib/ldaptic/filter.rb', line 42

def &(other)
  And.new(self, other)
end

#inspectObject



65
66
67
68
69
70
71
# File 'lib/ldaptic/filter.rb', line 65

def inspect
  if string = process
    "#<#{Ldaptic::Filter.inspect} #{string}>"
  else
    "#<#{Ldaptic::Filter.inspect} invalid>"
  end
end

#to_berObject

:nodoc:



77
78
79
# File 'lib/ldaptic/filter.rb', line 77

def to_ber #:nodoc:
  to_net_ldap_filter.to_ber
end

#to_net_ldap_filterObject

:nodoc:



73
74
75
# File 'lib/ldaptic/filter.rb', line 73

def to_net_ldap_filter #:nodoc:
  Net::LDAP::Filter.construct(process)
end

#to_sObject Also known as: to_str

Generates the filter as a string.



59
60
61
# File 'lib/ldaptic/filter.rb', line 59

def to_s
  process || "(objectClass=*)"
end

#|(other) ⇒ Object

Combine two filters with a logical OR.



47
48
49
# File 'lib/ldaptic/filter.rb', line 47

def |(other)
  Or.new(self, other)
end

#~Object

Negate a filter.

~Ldaptic::Filter("(a=1)").to_s # => "(!(a=1))"


54
55
56
# File 'lib/ldaptic/filter.rb', line 54

def ~
  Not.new(self)
end