Module: JsonbOperations::Arel::Visitors

Includes:
Kernel
Defined in:
lib/jsonb_operations/arel/visitors.rb

Overview

typed: strict frozen_string_literal: true

Constant Summary collapse

INFIX_OPERATORS =
{
  'FetchElement' => ' -> ',
  'FetchField' => ' -> ',
  'FetchElementText' => ' ->> ',
  'FetchFieldText' => ' ->> ',
  'FetchPath' => ' #> ',
  'FetchPathText' => ' #>> ',
  'Contains' => ' @> ',
  'ContainedBy' => ' <@ ',
  'HasKey' => ' ? ',
  'HasAnyKey' => ' ?| ',
  'HasAllKeys' => ' ?& ',
  'Concat' => ' || ',
  'DeleteKey' => ' - ',
  'DeleteKeys' => ' - ',
  'DeleteElement' => ' - ',
  'DeletePath' => ' #- ',
  'PathExists' => ' @? ',
  'PathMatch' => ' @@ ',
}.freeze

Instance Method Summary collapse

Instance Method Details

#visit_Arel_Nodes_Jsonb_TextArray(o, collector) ⇒ Object

: (Arel::Nodes::Jsonb::TextArray, untyped) -> untyped



37
38
39
40
41
42
43
44
45
46
# File 'lib/jsonb_operations/arel/visitors.rb', line 37

def visit_Arel_Nodes_Jsonb_TextArray(o, collector) # rubocop:disable Naming/MethodName -- Arel visitor dispatch requires this exact naming convention
  conn = send(:instance_variable_get, :@connection)
  collector << 'ARRAY['
  o.values.each_with_index do |v, i|
    collector << ', ' if i > 0
    collector << conn.quote(v)
  end
  collector << ']'
  collector
end