Class: Trollop::IntegerOption

Inherits:
Option
  • Object
show all
Defined in:
lib/rbcli/util/trollop.rb

Overview

Integer number option class.

Direct Known Subclasses

IntegerArrayOption

Instance Attribute Summary

Attributes inherited from Option

#default, #long, #multi_given, #name, #permitted, #short

Instance Method Summary collapse

Methods inherited from Option

#array_default?, #callback, create, #desc, #description_with_default, #description_with_permitted, #educate, #flag?, #full_description, #initialize, #multi, #multi_arg?, #opts, #opts=, register_alias, #required?, #short?, #single_arg?

Constructor Details

This class inherits a constructor from Trollop::Option

Instance Method Details

#parse(paramlist, _neg_given) ⇒ Object



818
819
820
821
822
823
824
825
# File 'lib/rbcli/util/trollop.rb', line 818

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



817
# File 'lib/rbcli/util/trollop.rb', line 817

def type_format ; "=<i>" ; end