Class: GlueGun::Types::DateTimeType

Inherits:
ActiveModel::Type::Value
  • Object
show all
Defined in:
lib/glue_gun/types/date_time_type.rb

Instance Method Summary collapse

Instance Method Details

#cast(value) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/glue_gun/types/date_time_type.rb', line 4

def cast(value)
  case value
  when String
    parse_string(value)
  when Date, DateTime
    value
  end
end

#serialize(value) ⇒ Object



13
14
15
# File 'lib/glue_gun/types/date_time_type.rb', line 13

def serialize(value)
  value.to_s
end