Sha256: e452cee16f84bec0e860a24aaf9e732697675ee45aa91a8d5a8fe2bb2c4f731b
Contents?: true
Size: 607 Bytes
Versions: 6
Compression:
Stored size: 607 Bytes
Contents
require 'parameters/types/object' require 'time' module Parameters module Types class Time < Object # # Coerces a value into a Time object. # # @param [Integer, #to_time, #to_s] value # The value to coerce. # # @return [::Time] # The coerced Time object. # def self.coerce(value) case value when Integer ::Time.at(value) else if value.respond_to?(:to_time) value.to_time else ::Time.parse(value.to_s) end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems