Module: ROM::LDAP::Dataset::Conversion

Included in:
ROM::LDAP::Dataset
Defined in:
lib/rom/ldap/dataset/conversion.rb

Overview

Parsing Formats

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object

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.

Extends the class with filter abstraction behavior.



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rom/ldap/dataset/conversion.rb', line 17

def self.included(klass)
  klass.class_eval do
    extend Dry::Core::ClassAttributes

    defines :filter_class
    filter_class Parsers::FilterSyntax

    defines :ast_class
    ast_class Parsers::AbstractSyntax
  end
end

Instance Method Details

#to_astArray

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.

Combine original relation dataset name (LDAP filter string)

with search criteria (AST).

Returns:

  • (Array)


44
45
46
# File 'lib/rom/ldap/dataset/conversion.rb', line 44

def to_ast
  criteria.empty? ? source_ast : [:con_and, [source_ast, criteria]]
end

#to_filterString

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.

Convert the full query to an LDAP filter string

Returns:

  • (String)


34
35
36
# File 'lib/rom/ldap/dataset/conversion.rb', line 34

def to_filter
  self.class.ast_class.new(to_ast, directory.attribute_types).call.to_filter
end