Class: SQLiteTypes::Interval
- Inherits:
-
ActiveRecord::Type::Value
- Object
- ActiveRecord::Type::Value
- SQLiteTypes::Interval
- Defined in:
- lib/sqlite_types/interval.rb
Instance Method Summary collapse
Instance Method Details
#serialize(value) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/sqlite_types/interval.rb', line 7 def serialize(value) case value when ::ActiveSupport::Duration value.iso8601(precision: precision) when ::Numeric ::ActiveSupport::Duration.build(value).iso8601(precision: precision) else super end end |
#type_cast_for_schema(value) ⇒ Object
18 19 20 |
# File 'lib/sqlite_types/interval.rb', line 18 def type_cast_for_schema(value) serialize(value).inspect end |