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
45 |
# File 'lib/shellopts/argument_type.rb', line 45 def convert(value) value.to_i end |
#match?(name, literal) ⇒ Boolean
39 40 41 42 |
# File 'lib/shellopts/argument_type.rb', line 39 def match?(name, literal) literal =~ /^-?\d+$/ or "Illegal integer value in #{name}: #{literal}" end |
#value?(value) ⇒ Boolean
44 |
# File 'lib/shellopts/argument_type.rb', line 44 def value?(value) value.is_a?(Integer) end |