Class: StrongerParameters::TimeConstraint
- Inherits:
-
Constraint
- Object
- Constraint
- StrongerParameters::TimeConstraint
- Defined in:
- lib/stronger_parameters/constraints/time_constraint.rb
Instance Method Summary collapse
Methods inherited from Constraint
#&, #==, #required, #required?, #|
Instance Method Details
permalink #value(v) ⇒ Object
[View source]
7 8 9 10 11 12 13 14 15 |
# File 'lib/stronger_parameters/constraints/time_constraint.rb', line 7 def value(v) return v if v.is_a?(Time) begin Time.parse v rescue ArgumentError, TypeError StrongerParameters::InvalidValue.new(v, "must be a time") end end |