class Formulario::Field::Time
Private Class Methods
allowed_keys()
click to toggle source
# File lib/formulario/fields/time.rb, line 11 def self.allowed_keys %i[ year month day hour minute second timezone ] end
base_class()
click to toggle source
# File lib/formulario/fields/time.rb, line 7 def self.base_class ::Time end
parse_hash(hash)
click to toggle source
# File lib/formulario/fields/time.rb, line 15 def self.parse_hash(hash) return invalid_keys_exceptional_value(hash) if has_invalid_keys?(hash) now = ::Time.now new ::Time.new( hash[:year] || now.year, hash[:month] || now.month, hash[:day] || now.day, hash[:hour] || now.hour, hash[:minute] || now.min, hash[:second] || now.sec, hash[:timezone] || now.zone, ) end