Class: AssociateJsonb::ArelNodes::Jsonb::HashArrow

Inherits:
Operator
  • Object
show all
Defined in:
lib/associate_jsonb/arel_nodes/jsonb/hash_arrow.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Operator

#name, #relation

Instance Method Summary collapse

Methods inherited from Operator

#initialize

Constructor Details

This class inherits a constructor from AssociateJsonb::ArelNodes::Jsonb::Operator

Instance Method Details

#contains(value) ⇒ Object



16
17
18
# File 'lib/associate_jsonb/arel_nodes/jsonb/hash_arrow.rb', line 16

def contains(value)
  ArelNodes::Jsonb::AtArrow.new(relation, self, value)
end

#intersects_with(array) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'lib/associate_jsonb/arel_nodes/jsonb/hash_arrow.rb', line 20

def intersects_with(array)
  ::Arel::Nodes::InfixOperation.new(
    '>',
    ::Arel::Nodes::NamedFunction.new(
      'jsonb_array_length',
      [ ArelNodes::Jsonb::DoublePipe.new(relation, self, array) ]
    ),
    0
  )
end

#operatorObject



8
9
10
# File 'lib/associate_jsonb/arel_nodes/jsonb/hash_arrow.rb', line 8

def operator
  '#>'
end

#right_sideObject



12
13
14
# File 'lib/associate_jsonb/arel_nodes/jsonb/hash_arrow.rb', line 12

def right_side
  ::Arel::Nodes::SqlLiteral.new("'{#{name}}'")
end