Class: ROM::LDAP::Expression Private

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

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.

Instance Method Summary collapse

Instance Method Details

#inspectString

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.

Returns:

  • (String)


71
72
73
# File 'lib/rom/ldap/expression.rb', line 71

def inspect
  %(#<#{self.class} #{to_raw_filter} />)
end

#to_astArray Also known as: to_a

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.

AST with original atrributes and values

Returns:

  • (Array)


58
59
60
61
62
63
64
65
66
# File 'lib/rom/ldap/expression.rb', line 58

def to_ast
  case op
  when :con_and then [op, exps.map(&:to_ast)]
  when :con_or  then [op, exps.map(&:to_ast)]
  when :con_not then [op, exps[0].to_ast]
  else
    [op, field, value]
  end
end

#to_berString

Returns:

  • (String)


23
24
25
26
# File 'lib/rom/ldap/expression.rb', line 23

def to_ber
  require 'rom/ldap/expression_encoder'
  ExpressionEncoder.new(options).call
end

#to_filterString Also known as: to_s

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.

Bracketed filter string

Returns:

  • (String)


49
50
51
# File 'lib/rom/ldap/expression.rb', line 49

def to_filter
  "(#{to_raw_filter})"
end

#to_raw_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.

Unbracketed filter string

Returns:

  • (String)


32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/rom/ldap/expression.rb', line 32

def to_raw_filter
  case op
  when :op_eql, :op_bineq then "#{field}=#{value}"
  when :op_ext  then "#{field}:=#{value}"
  when :op_gte  then "#{field}>=#{value}"
  when :op_lte  then "#{field}<=#{value}"
  when :op_prx  then "#{field}~=#{value}"
  when :con_and then "&#{exps.map(&:to_filter).join}"
  when :con_or  then "|#{exps.map(&:to_filter).join}"
  when :con_not then "!#{exps[0].to_filter}"
  end
end