Class: ShellOpts::Grammar::IntegerArgument
- Inherits:
-
ArgumentType
- Object
- ArgumentType
- ShellOpts::Grammar::IntegerArgument
- Defined in:
- lib/shellopts/argument_type.rb
Instance Attribute Summary
Attributes inherited from ArgumentType
Instance Method Summary collapse
Methods inherited from ArgumentType
Instance Method Details
#convert(value) ⇒ Object
46 |
# File 'lib/shellopts/argument_type.rb', line 46 def convert(value) value.to_i end |
#match?(name, literal) ⇒ Boolean
40 41 42 43 |
# File 'lib/shellopts/argument_type.rb', line 40 def match?(name, literal) literal =~ /^-?\d+$/ or "Illegal integer value in #{name}: #{literal}" end |
#value?(value) ⇒ Boolean
45 |
# File 'lib/shellopts/argument_type.rb', line 45 def value?(value) value.is_a?(Integer) end |