class Optimist::IntegerOption

Integer number option class.

Public Instance Methods

as_type(param) click to toggle source
# File lib/optimist.rb, line 1027
def as_type(param) ; param.to_i ; end
parse(paramlist, _neg_given) click to toggle source
# File lib/optimist.rb, line 1028
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_]+$/
      as_type(param)
    end
  end
end
type_format() click to toggle source
# File lib/optimist.rb, line 1026
def type_format ; "=<i>" ; end