Class: Flags::DisallowedValuesValidator
- Inherits:
-
FlagValidator
- Object
- FlagValidator
- Flags::DisallowedValuesValidator
- Defined in:
- lib/flags.rb
Overview
A validator that raises an error if the flag’s value is in the provided set of disallowed values.
Instance Method Summary collapse
-
#initialize(*disallowed_values) ⇒ DisallowedValuesValidator
constructor
A new instance of DisallowedValuesValidator.
Methods inherited from FlagValidator
Constructor Details
#initialize(*disallowed_values) ⇒ DisallowedValuesValidator
Returns a new instance of DisallowedValuesValidator.
406 407 408 409 410 411 |
# File 'lib/flags.rb', line 406 def initialize(*disallowed_values) disallowed_values = disallowed_values.to_a.flatten proc = Proc.new { |flag_value| !disallowed_values.include?(flag_value) } = "illegal value, may not be one of [#{disallowed_values.join(',')}]" super(proc, ) end |