Class: ShellOpts::Grammar::Node
- Inherits:
-
Object
- Object
- ShellOpts::Grammar::Node
- Defined in:
- lib/shellopts/grammar/node.rb
Overview
Root class for Grammar objects
Node objects are created by ShellOpts::Grammar.compile that returns a Program object that in turn contains other node objects in a hierarchical structure that reflects the grammar of the program. Only ShellOpts::Grammar.compile should create node objects
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Key (Symbol) of node.
Instance Method Summary collapse
-
#dump(&block) ⇒ Object
:nocov:.
-
#initialize(key) ⇒ Node
constructor
A new instance of Node.
Constructor Details
#initialize(key) ⇒ Node
Returns a new instance of Node.
13 14 15 |
# File 'lib/shellopts/grammar/node.rb', line 13 def initialize(key) @key = key end |
Instance Attribute Details
#key ⇒ Object (readonly)
Key (Symbol) of node. Unique within the enclosing command
11 12 13 |
# File 'lib/shellopts/grammar/node.rb', line 11 def key @key end |
Instance Method Details
#dump(&block) ⇒ Object
:nocov:
18 19 20 21 |
# File 'lib/shellopts/grammar/node.rb', line 18 def dump(&block) puts key.inspect indent { yield } if block_given? end |