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