Class: Ldap::Relations::Relation

Inherits:
Object
  • Object
show all
Defined in:
lib/ldap-relations/relation.rb

Overview

This class describes an individual filter that can be combined with others to be passed to an LDAP server as part of a search.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Relation

Returns a new instance of Relation.



5
6
7
8
# File 'lib/ldap-relations/relation.rb', line 5

def initialize params={}
  @operator = params.fetch :operator, :and
  @params = params
end

Instance Attribute Details

#operatorObject

Returns the value of attribute operator.



10
11
12
# File 'lib/ldap-relations/relation.rb', line 10

def operator
  @operator
end

#paramsObject

Returns the value of attribute params.



10
11
12
# File 'lib/ldap-relations/relation.rb', line 10

def params
  @params
end

Instance Method Details

#to_filterObject



12
13
14
# File 'lib/ldap-relations/relation.rb', line 12

def to_filter
  @params.map {|key, value| "#{key}=#{value}" }.join
end