Class: Arel::Nodes::Jsonb::TextArray

Inherits:
Node
  • Object
show all
Defined in:
lib/jsonb_operations/arel/nodes.rb

Overview

Renders a Ruby array as a PostgreSQL ARRAY[‘a’, ‘b’] expression.

Instance Method Summary collapse

Constructor Details

#initialize(values) ⇒ TextArray

: (untyped values) -> void



74
75
76
77
# File 'lib/jsonb_operations/arel/nodes.rb', line 74

def initialize(values)
  super()
  @values = Array(values).map(&:to_s) #: Array[String]
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?

: (untyped other) -> bool



80
81
82
83
84
# File 'lib/jsonb_operations/arel/nodes.rb', line 80

def ==(other)
  return false if !other.is_a?(TextArray)

  values == other.values
end

#hashObject

: () -> Integer



88
89
90
# File 'lib/jsonb_operations/arel/nodes.rb', line 88

def hash
  values.hash
end

#valuesObject

: () -> Array



69
70
71
# File 'lib/jsonb_operations/arel/nodes.rb', line 69

def values
  @values
end