Class: ROM::LDAP::Parsers::AbstractSyntax Private

Inherits:
Object
  • Object
show all
Extended by:
Initializer
Defined in:
lib/rom/ldap/parsers/abstract_syntax.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Parses and AST into and Expression/RFC filter

Instance Method Summary collapse

Instance Method Details

#callObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/rom/ldap/parsers/abstract_syntax.rb', line 20

def call
  case ast.size

  # Join or negate expression
  when 2
    constructor, part = ast

    expressions =
      if constructor.eql?(:con_not)
        [express(part)]
      else
        part.map(&method(:express))
      end

    Expression.new(op: constructor, exps: expressions)

  # Create expression
  when 3
    operator, attribute, value = ast

    Expression.new(
      op: operator,
      field: decode_attribute(attribute),
      value: decode_value(value)
    )
  end
end