Class: Neighbor::Type::Halfvec

Inherits:
ActiveRecord::Type::Value
  • Object
show all
Defined in:
lib/neighbor/type/halfvec.rb

Instance Method Summary collapse

Instance Method Details

#serialize(value) ⇒ Object



8
9
10
11
12
13
# File 'lib/neighbor/type/halfvec.rb', line 8

def serialize(value)
  if value.is_a?(Array)
    value = "[#{value.map(&:to_f).join(",")}]"
  end
  super(value)
end

#typeObject



4
5
6
# File 'lib/neighbor/type/halfvec.rb', line 4

def type
  :halfvec
end