| Class | Commands::Parser |
| In: |
commands/parser.rb
|
| Parent: | Object |
Main user input parsing class. It receives user input (lines of text) and forwards the request to the corresponding dispatcher.
Parse a single line of text. Cycles through the list of registered dispatchers. When a dispatcher is found to be able to handle the user‘s request, the execution is passed to it.
# File commands/parser.rb, line 32
32: def parse(text)
33: dispatch text.split.shift, *text.split
34: end
In the same way Parser.parse, this method dispatches a command to the specific module that can handle it.
This function is intended to be used programatically while Parser.parse is meant to be used with direct user input.
# File commands/parser.rb, line 41
41: def run2(cmd, *params)
42: raise 're-think!'
43: #dispatch cmd, *(params.unshift cmd)
44: end