Class: Arel::Nodes::JSONBHashArrow

Inherits:
JSONBOperator
  • Object
show all
Defined in:
lib/arel/nodes/jsonb_hash_arrow.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from JSONBOperator

#name, #relation

Instance Method Summary collapse

Methods inherited from JSONBOperator

#initialize

Constructor Details

This class inherits a constructor from Arel::Nodes::JSONBOperator

Instance Method Details

#contains(value) ⇒ Object



12
13
14
# File 'lib/arel/nodes/jsonb_hash_arrow.rb', line 12

def contains(value)
  Arel::Nodes::JSONBAtArrow.new(relation, self, value)
end

#intersects_with(array) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/arel/nodes/jsonb_hash_arrow.rb', line 16

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

#operatorObject



4
5
6
# File 'lib/arel/nodes/jsonb_hash_arrow.rb', line 4

def operator
  '#>'
end

#right_sideObject



8
9
10
# File 'lib/arel/nodes/jsonb_hash_arrow.rb', line 8

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