Class: OptimistXL::IntegerOption

Inherits:
Option
  • Object
show all
Defined in:
lib/optimist_xl.rb

Overview

Integer number option class.

Direct Known Subclasses

IntegerArrayOption

Instance Attribute Summary

Attributes inherited from Option

#default, #long, #max_args, #min_args, #multi_given, #name, #permitted, #permitted_response, #short

Instance Method Summary collapse

Methods inherited from Option

#array_default?, #callback, #compatible_with?, create, #desc, #description_with_default, #description_with_permitted, #doesnt_need_autogen_short, #educate, #format_stdio, #full_description, handle_long_opt, handle_short_opt, #initialize, #multi, #opts, #opts=, #permitted_type_valid?, #permitted_valid_string, #permitted_value?, register_alias, #required?, #validate_permitted

Constructor Details

This class inherits a constructor from OptimistXL::Option

Instance Method Details

#parse(paramlist, _neg_given) ⇒ Object



1164
1165
1166
1167
1168
1169
1170
1171
# File 'lib/optimist_xl.rb', line 1164

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_formatObject



1163
# File 'lib/optimist_xl.rb', line 1163

def type_format ; "=<i>" ; end