Class: Flags::RangeValidator
- Inherits:
-
FlagValidator
- Object
- FlagValidator
- Flags::RangeValidator
- Defined in:
- lib/flags.rb
Overview
A validator that raises an error if the flag’s value is outside the given Range. No type checking is performed (that’s the job of the ClassValidator).
Instance Method Summary collapse
-
#initialize(range) ⇒ RangeValidator
constructor
A new instance of RangeValidator.
Methods inherited from FlagValidator
Constructor Details
#initialize(range) ⇒ RangeValidator
Returns a new instance of RangeValidator.
387 388 389 390 391 |
# File 'lib/flags.rb', line 387 def initialize(range) proc = Proc.new { |flag_value| range.include?(flag_value) } = "value out of range! Valid range is #{range.inspect}" super(proc, ) end |