Class: OptParseValidator::OptInteger
- Defined in:
- lib/opt_parse_validator/opts/integer.rb
Overview
Implementation of the Integer Option
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from OptBase
Instance Method Summary collapse
Methods inherited from OptBase
#advanced?, #alias?, #append_help_messages, #choices, #default, #help_message_for_default, #help_messages, #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
9 10 11 12 13 |
# File 'lib/opt_parse_validator/opts/integer.rb', line 9 def validate(value) raise Error, "#{value} is not an integer" if value.to_i.to_s != value value.to_i end |