Class: StrongerParameters::NilStringConstraint
- Inherits:
-
Constraint
- Object
- Constraint
- StrongerParameters::NilStringConstraint
- Defined in:
- lib/stronger_parameters/constraints/nil_string_constraint.rb
Constant Summary collapse
- NULL_VALUES =
[nil, "", "undefined"].freeze
Instance Method Summary collapse
Methods inherited from Constraint
#&, #==, #required, #required?, #|
Instance Method Details
#value(v) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/stronger_parameters/constraints/nil_string_constraint.rb', line 9 def value(v) if NULL_VALUES.include?(v) nil else StrongerParameters::InvalidValue.new(v, "must be a nil string") end end |