Class: Recheck::Optimist::IntegerOption
- Defined in:
- lib/recheck/vendor/optimist.rb
Overview
Integer number option class.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Option
#default, #long, #multi_given, #name, #permitted, #permitted_response, #short
Instance Method Summary collapse
Methods inherited from Option
#array_default?, #callback, create, #desc, #doesnt_need_autogen_short, #educate, #flag?, #format_stdio, #full_description, #initialize, #multi, #multi_arg?, #opts, #opts=, #permitted_type_valid?, #permitted_valid_string, #permitted_value?, register_alias, #required?, #single_arg?, #validate_permitted
Constructor Details
This class inherits a constructor from Recheck::Optimist::Option
Instance Method Details
#as_type(param) ⇒ Object
1071 1072 1073 |
# File 'lib/recheck/vendor/optimist.rb', line 1071 def as_type(param) param.to_i end |
#parse(paramlist, _neg_given) ⇒ Object
1075 1076 1077 1078 1079 1080 1081 1082 |
# File 'lib/recheck/vendor/optimist.rb', line 1075 def parse(paramlist, _neg_given) paramlist.map do |pg| pg.map do |param| raise CommandlineError, "option '#{name}' needs an integer" unless param.is_a?(Numeric) || param =~ /^-?[\d_]+$/ as_type(param) end end end |
#type_format ⇒ Object
1067 1068 1069 |
# File 'lib/recheck/vendor/optimist.rb', line 1067 def type_format "=<i>" end |