Class: Arelastic::Nodes::Node

Inherits:
Object
  • Object
show all
Extended by:
Arities::Binary, Arities::Polyadic, Arities::Unary
Defined in:
lib/arelastic/nodes/node.rb

Instance Method Summary collapse

Methods included from Arities::Binary

binary

Methods included from Arities::Polyadic

polyadic

Methods included from Arities::Unary

unary

Instance Method Details

#==(other) ⇒ Object



16
17
18
# File 'lib/arelastic/nodes/node.rb', line 16

def ==(other)
  other.is_a?(Arelastic::Nodes::Node) && as_elastic == other.as_elastic
end

#convert_to_elastic(expr) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/arelastic/nodes/node.rb', line 8

def convert_to_elastic(expr)
  if expr.is_a?(Array)
    expr.map { |e| convert_to_elastic(e) }
  else
    expr.respond_to?(:as_elastic) ? expr.as_elastic : expr
  end
end