class Parameters::Types::Date
Public Class Methods
coerce(value)
click to toggle source
Coerces a value into a Date
.
@param [::String, to_date] value
The value to coerce.
@return [::Date]
The coerced Date.
# 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