Class: Query::Node::Operator

Inherits:
Query::Node show all
Defined in:
lib/query/node/operator.rb

Constant Summary collapse

OPERATORS =
{
  "^" => "^",
  "$" => "$",
  ">=" => ">=",
  "=>" => ">=",
  "<=" => "<=",
  "=<" => "<=",
  "<" => "<",
  ">" => ">",
  "!" => "!",
  ":::" => ":",
  "::" => ":",
  ":" => ":",
  "=" => "=",
  "==" => "=",
  "===" => "=",
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parsed) ⇒ Operator

Returns a new instance of Operator.



26
27
28
# File 'lib/query/node/operator.rb', line 26

def initialize(parsed)
  self.operator = parsed
end

Instance Attribute Details

#operatorObject

Returns the value of attribute operator.



6
7
8
# File 'lib/query/node/operator.rb', line 6

def operator
  @operator
end

Instance Method Details

#evaluate(**args) ⇒ Object



30
31
32
# File 'lib/query/node/operator.rb', line 30

def evaluate(**args)
  OPERATORS.fetch(operator)
end