Class: UsageMod::IntegerArgumentPlugin

Inherits:
ArgumentParserPlugin show all
Defined in:
lib/Usage.rb

Instance Attribute Summary

Attributes inherited from ArgumentParserPlugin

#value

Instance Method Summary collapse

Methods inherited from ArgumentParserPlugin

#close

Constructor Details

#initialize(usage_ui, str) ⇒ IntegerArgumentPlugin

is an error, throw a InvalidIntegerError exception.



425
426
427
428
429
430
431
# File 'lib/Usage.rb', line 425

def initialize(usage_ui, str)
  if /^-?\d+/.match(str) then
    @value = str.to_i
  else
    raise InvalidIntegerError.new(str)
  end
end