Module: Neighbor::PostgreSQL::ArrayMethods

Defined in:
lib/neighbor/postgresql.rb

Instance Method Summary collapse

Instance Method Details

#type_cast_array(value, method) ⇒ Object



49
50
51
52
53
54
55
# File 'lib/neighbor/postgresql.rb', line 49

def type_cast_array(value, method, ...)
  if (subtype.is_a?(Neighbor::Type::Vector) || subtype.is_a?(Neighbor::Type::Halfvec)) && method != :deserialize && value.is_a?(::Array) && value.all? { |v| v.is_a?(::Numeric) }
    super(ArrayWrapper.new(value), method, ...)
  else
    super
  end
end