class ROM::LDAP::Expression

@api private

Public Instance Methods

inspect() click to toggle source

@return [String]

# File lib/rom/ldap/expression.rb, line 71
def inspect
  %(#<#{self.class} #{to_raw_filter} />)
end
to_a()
Alias for: to_ast
to_ast() click to toggle source

AST with original atrributes and values

@return [Array]

# 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
Also aliased as: to_a
to_ber() click to toggle source

@return [String]

@api public

# File lib/rom/ldap/expression.rb, line 23
def to_ber
  require 'rom/ldap/expression_encoder'
  ExpressionEncoder.new(**options).call
end
to_filter() click to toggle source

Bracketed filter string

@return [String]

# File lib/rom/ldap/expression.rb, line 49
def to_filter
  "(#{to_raw_filter})"
end
Also aliased as: to_s
to_raw_filter() click to toggle source

Unbracketed filter string

@return [String]

# 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
to_s()
Alias for: to_filter