class Formalism::Form::Coercion::Time

Class for coercion to Time

Private Instance Methods

execute() click to toggle source
# File lib/formalism/form/coercion/time.rb, line 10
def execute
        case @value
        when ::String
                ::Time.parse @value
        when ::Integer
                ::Time.at @value
        end
rescue ArgumentError => e
        raise unless e.message.include? 'out of range'
end