Module: ArelHash

Defined in:
lib/arel_hash.rb,
lib/arel_hash/version.rb,
lib/arel_hash/optimizer.rb,
lib/arel_hash/sanitizer.rb,
lib/arel_hash/node_factory.rb,
lib/arel_hash/arel_hash_factory.rb

Defined Under Namespace

Classes: ArelHashFactory, NodeFactory, Optimizer, Sanitizer

Constant Summary collapse

Nodes =
Arel::Nodes
Equality =
Nodes::Equality
ZERO_RESULTS_NODE =
Equality.new(Nodes::build_quoted('f'), Nodes::build_quoted('t'))
ZERO_RESULTS_HASH =
{ or: [] }
NO_FILTER_HASH =
{ and: [] }
VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.create_from_active_record(hash, properties) ⇒ Object



28
29
30
# File 'lib/arel_hash.rb', line 28

def self.create_from_active_record(hash, properties)
  ArelHashFactory.new(properties).create_from_active_record(hash)
end

.create_node(table, hash) ⇒ Object



19
20
21
# File 'lib/arel_hash.rb', line 19

def self.create_node(table, hash)
  NodeFactory.new(table).create_node(hash)
end

.singleton_tuple!(hash) ⇒ Object



23
24
25
26
# File 'lib/arel_hash.rb', line 23

def self.singleton_tuple!(hash)
  raise "#{hash}: only hashes with maximum one key are supported" unless hash.length == 1
  return hash.keys.first, hash.values.first
end