Class: CommandParser
- Inherits:
-
Object
- Object
- CommandParser
- Defined in:
- lib/runnable/command_parser.rb
Overview
Base class to create a command-line parameter parser.
It holds that parameters in a hash and the child has to be the one who return the formatted string according to the standard used.
Instance Method Summary collapse
-
#add_param(param, value = nil) ⇒ nil
Add params and value to the params hash to be parsed.
-
#initialize ⇒ CommandParser
constructor
Create a new instance of the parser.
-
#parse ⇒ Array
abstract
This method has to be overwritten in the child.
Constructor Details
#initialize ⇒ CommandParser
Create a new instance of the parser.
26 27 28 |
# File 'lib/runnable/command_parser.rb', line 26 def initialize @params = {} end |
Instance Method Details
#add_param(param, value = nil) ⇒ nil
Add params and value to the params hash to be parsed.
34 35 36 |
# File 'lib/runnable/command_parser.rb', line 34 def add_param( param, value = nil ) @params[param] = value end |
#parse ⇒ Array
This method is abstract.
This method has to be overwritten in the child
41 42 |
# File 'lib/runnable/command_parser.rb', line 41 def parse end |