Class: Uorm::Attributes::Type::Time

Inherits:
Object
  • Object
show all
Defined in:
lib/uorm/attributes/type.rb

Class Method Summary collapse

Class Method Details

.as_json(value) ⇒ Object



49
50
51
# File 'lib/uorm/attributes/type.rb', line 49

def as_json value
  value.to_i
end

.convert(value) ⇒ Object



43
44
45
46
47
# File 'lib/uorm/attributes/type.rb', line 43

def convert value
  ::Time.parse value.to_s
rescue
  ::Time.utc(value.to_i)
end