Sha256: 7eda9720a303ccd0c8e5ae99bac759c1ec0003a032c30f9b95d7259da2b28bb8
Contents?: true
Size: 485 Bytes
Versions: 6
Compression:
Stored size: 485 Bytes
Contents
require 'parameters/types/object' require 'date' module Parameters module Types class Date < Object # # Coerces a value into a Date. # # @param [::String, #to_date] value # The value to coerce. # # @return [::Date] # The coerced Date. # def self.coerce(value) if value.respond_to?(:to_date) value.to_date else ::Date.parse(value.to_s) end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems