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



22
23
24
# File 'lib/arelastic/nodes/node.rb', line 22

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
15
16
# 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) }
  elsif expr.is_a?(Hash)
    expr.transform_values { |e| convert_to_elastic(e) }
  else
    expr.respond_to?(:as_elastic) ? expr.as_elastic : expr
  end
end

#read_option!(options, key) ⇒ Object



18
19
20
# File 'lib/arelastic/nodes/node.rb', line 18

def read_option!(options, key)
  options.delete(key) || options.delete(key.to_sym)
end