Class: LDAP::Filter::Compound
- Inherits:
-
Object
- Object
- LDAP::Filter::Compound
- Defined in:
- lib/ldap/filter/compound.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#operator ⇒ Object
readonly
Returns the value of attribute operator.
Instance Method Summary collapse
- #&(filter) ⇒ Object
- #<<(filter) ⇒ Object
-
#initialize(operator, key_or_mappings, *values) ⇒ Compound
constructor
A new instance of Compound.
- #to_s ⇒ Object
- #|(filter) ⇒ Object
Constructor Details
#initialize(operator, key_or_mappings, *values) ⇒ Compound
Returns a new instance of Compound.
7 8 9 10 11 12 13 14 |
# File 'lib/ldap/filter/compound.rb', line 7 def initialize operator, key_or_mappings, *values @children = case key_or_mappings when Symbol then populate_from_values key_or_mappings, values when Array then grep key_or_mappings when Hash then populate_from_hash key_or_mappings end @operator = operator unless @operator end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
5 6 7 |
# File 'lib/ldap/filter/compound.rb', line 5 def children @children end |
#operator ⇒ Object (readonly)
Returns the value of attribute operator.
5 6 7 |
# File 'lib/ldap/filter/compound.rb', line 5 def operator @operator end |
Instance Method Details
#&(filter) ⇒ Object
32 33 34 |
# File 'lib/ldap/filter/compound.rb', line 32 def & filter AndFilter.new [self, filter] end |
#<<(filter) ⇒ Object
23 24 25 26 |
# File 'lib/ldap/filter/compound.rb', line 23 def << filter raise ArgumentError, 'invalid representation of a filter' unless valid_filter?(filter) @children << filter end |
#to_s ⇒ Object
16 17 18 19 20 21 |
# File 'lib/ldap/filter/compound.rb', line 16 def to_s filter = '(' filter << @operator.to_s filter << @children.map(&:to_s).join filter << ')' end |