Module: AssociateJsonb::Relation::WhereClause

Defined in:
lib/associate_jsonb/relation/where_clause.rb

Instance Method Summary collapse

Instance Method Details

#to_h(table_name = nil, equality_only: false) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/associate_jsonb/relation/where_clause.rb', line 7

def to_h(table_name = nil, equality_only: false)
  equalities(predicates, equality_only).each_with_object({}) do |node, hash|
    next if table_name&.!= node.original_left.relation.name
    name = node.original_left.name.to_s
    value = extract_node_value(node.right)
    hash[name] = value
  end
end