Class: Contentful::DateCoercion
- Inherits:
-
BaseCoercion
- Object
- BaseCoercion
- Contentful::DateCoercion
- Defined in:
- lib/contentful/coercions.rb
Overview
Coercion for Date Types
Instance Attribute Summary
Attributes inherited from BaseCoercion
Instance Method Summary collapse
-
#coerce ⇒ Object
Coerces value to DateTime.
Methods inherited from BaseCoercion
Constructor Details
This class inherits a constructor from Contentful::BaseCoercion
Instance Method Details
#coerce ⇒ Object
Coerces value to DateTime
62 63 64 65 66 67 |
# File 'lib/contentful/coercions.rb', line 62 def coerce(*) return nil if value.nil? return value if value.is_a?(Date) DateTime.parse(value) end |