Class: OptParseValidator::OptPositiveInteger
- Inherits:
-
OptInteger
- Object
- OptBase
- OptInteger
- OptParseValidator::OptPositiveInteger
- Defined in:
- lib/opt_parse_validator/opts/positive_integer.rb
Overview
Implementation of the Positive Integer Option
Instance Attribute Summary
Attributes inherited from OptBase
Instance Method Summary collapse
Methods inherited from OptBase
#choices, #default, #initialize, #normalize, #required?, #required_unless, #to_long, #to_s, #to_sym, #value_if_empty
Constructor Details
This class inherits a constructor from OptParseValidator::OptBase
Instance Method Details
#validate(value) ⇒ Integer
7 8 9 10 11 |
# File 'lib/opt_parse_validator/opts/positive_integer.rb', line 7 def validate(value) i = super(value) fail "#{i} is not > 0" unless i > 0 i end |