Class: ShellOpts::Ast::Parser
- Inherits:
-
Object
- Object
- ShellOpts::Ast::Parser
- Defined in:
- lib/shellopts/parser.rb
Overview
Parse a command line
Defined Under Namespace
Classes: Error
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(grammar, argv) ⇒ Parser
constructor
A new instance of Parser.
Constructor Details
#initialize(grammar, argv) ⇒ Parser
Returns a new instance of Parser.
23 24 25 26 |
# File 'lib/shellopts/parser.rb', line 23 def initialize(grammar, argv) @grammar, @argv = grammar, argv.dup = {} # Used to keep track of repeated options end |
Instance Method Details
#call ⇒ Object
28 29 30 31 32 33 |
# File 'lib/shellopts/parser.rb', line 28 def call program = Ast::Program.new(@grammar) parse_command(program) program.arguments = @argv program end |