Class: Parameters::Types::Date
- Defined in:
- lib/parameters/types/date.rb
Direct Known Subclasses
Class Method Summary collapse
-
.coerce(value) ⇒ ::Date
Coerces a value into a Date.
Methods inherited from Object
Methods inherited from Type
#<, #<=, #==, ===, #===, #coerce, #to_ruby, to_ruby
Class Method Details
.coerce(value) ⇒ ::Date
Coerces a value into a Date.
18 19 20 21 22 23 24 |
# File 'lib/parameters/types/date.rb', line 18 def self.coerce(value) if value.respond_to?(:to_date) value.to_date else ::Date.parse(value.to_s) end end |