Class: ArelHash::NodeFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/arel_hash/node_factory.rb

Instance Method Summary collapse

Constructor Details

#initialize(table) ⇒ NodeFactory

Returns a new instance of NodeFactory.

Parameters:

  • table (Arel::Table)

    the arel table to work on



4
5
6
# File 'lib/arel_hash/node_factory.rb', line 4

def initialize(table)
  @table = table
end

Instance Method Details

#create_node(hash) ⇒ Object

Parameters:

  • hash (Hash<Symbol, Hash<Symbol, Object>>)

    a hash, which is a serialization of an Arel::Node



9
10
11
12
# File 'lib/arel_hash/node_factory.rb', line 9

def create_node(hash)
  operator, value = ArelHash.singleton_tuple!(hash)
  do_create_node(operator, value)
end