Class: Optimist::IntegerOption
Overview
Integer number option class.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Option
#default, #long, #multi_given, #name, #short
Instance Method Summary collapse
Methods inherited from Option
#array_default?, #callback, create, #desc, #description_with_default, #educate, #flag?, #initialize, #multi, #multi_arg?, #opts, #opts=, register_alias, #required?, #short?, #single_arg?
Constructor Details
This class inherits a constructor from Optimist::Option
Instance Method Details
#parse(paramlist, _neg_given) ⇒ Object
790 791 792 793 794 795 796 797 |
# File 'lib/optimist.rb', line 790 def parse(paramlist, _neg_given) paramlist.map do |pg| pg.map do |param| raise CommandlineError, "option '#{self.name}' needs an integer" unless param.is_a?(Numeric) || param =~ /^-?[\d_]+$/ param.to_i end end end |
#type_format ⇒ Object
789 |
# File 'lib/optimist.rb', line 789 def type_format ; "=<i>" ; end |