Class: Neighbor::Type::Cube

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

Instance Method Summary collapse

Instance Method Details

#serialize(value) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/neighbor/type/cube.rb', line 8

def serialize(value)
  if value.is_a?(Array)
    if value.first.is_a?(Array)
      value = value.map { |v| serialize_point(v) }.join(", ")
    else
      value = serialize_point(value)
    end
  end
  super(value)
end

#typeObject



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

def type
  :cube
end