Class: Ardm::Ar::Serialization::Type

Inherits:
Object
  • Object
show all
Defined in:
lib/ardm/ar/serialization.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(column) ⇒ Type

Returns a new instance of Type.



63
64
65
# File 'lib/ardm/ar/serialization.rb', line 63

def initialize(column)
  @column = column
end

Instance Method Details

#typeObject



75
76
77
# File 'lib/ardm/ar/serialization.rb', line 75

def type
  @column.type
end

#type_cast(value) ⇒ Object



67
68
69
70
71
72
73
# File 'lib/ardm/ar/serialization.rb', line 67

def type_cast(value)
  if value.state == :serialized
    value.unserialized_value @column.type_cast value.value
  else
    value.unserialized_value
  end
end