Class: ArInterval::Type

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

Instance Method Summary collapse

Instance Method Details

#cast(value) ⇒ Object



3
4
5
# File 'lib/ar_interval/type.rb', line 3

def cast(value)
  ActiveSupport::Duration.parse(value)
end

#serialize(value) ⇒ Object



7
8
9
# File 'lib/ar_interval/type.rb', line 7

def serialize(value)
  value.iso8601
end