Class: Syntax::Node
- Inherits:
-
Treetop::Runtime::SyntaxNode
- Object
- Treetop::Runtime::SyntaxNode
- Syntax::Node
- Defined in:
- lib/silicon/routing/syntax/node.rb
Instance Attribute Summary collapse
-
#actions ⇒ Object
Returns the value of attribute actions.
-
#after_commands ⇒ Object
Returns the value of attribute after_commands.
-
#before_commands ⇒ Object
Returns the value of attribute before_commands.
-
#level ⇒ Object
Returns the value of attribute level.
-
#my_nodes ⇒ Object
Returns the value of attribute my_nodes.
-
#parent_node ⇒ Object
Returns the value of attribute parent_node.
-
#route ⇒ Object
Returns the value of attribute route.
Instance Method Summary collapse
Instance Attribute Details
#actions ⇒ Object
Returns the value of attribute actions.
3 4 5 |
# File 'lib/silicon/routing/syntax/node.rb', line 3 def actions @actions end |
#after_commands ⇒ Object
Returns the value of attribute after_commands.
3 4 5 |
# File 'lib/silicon/routing/syntax/node.rb', line 3 def after_commands @after_commands end |
#before_commands ⇒ Object
Returns the value of attribute before_commands.
3 4 5 |
# File 'lib/silicon/routing/syntax/node.rb', line 3 def before_commands @before_commands end |
#level ⇒ Object
Returns the value of attribute level.
3 4 5 |
# File 'lib/silicon/routing/syntax/node.rb', line 3 def level @level end |
#my_nodes ⇒ Object
Returns the value of attribute my_nodes.
3 4 5 |
# File 'lib/silicon/routing/syntax/node.rb', line 3 def my_nodes @my_nodes end |
#parent_node ⇒ Object
Returns the value of attribute parent_node.
3 4 5 |
# File 'lib/silicon/routing/syntax/node.rb', line 3 def parent_node @parent_node end |
#route ⇒ Object
Returns the value of attribute route.
3 4 5 |
# File 'lib/silicon/routing/syntax/node.rb', line 3 def route @route end |
Instance Method Details
#parse(parent_node = nil) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/silicon/routing/syntax/node.rb', line 5 def parse(parent_node = nil) @parent_node = parent_node elements.each do |element| if element.is_a? Indent @level = element.elements.length end if element.is_a? Route @route = element.parse(self) end if element.is_a? Actions @actions = element.parse(self) end if element.is_a? Nodes @my_nodes = element.parse(self) end if element.is_a? BeforeSection @before_commands = element.parse.commands end if element.is_a? AfterSection @after_commands = element.parse.commands end end self end |
#to_hash ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/silicon/routing/syntax/node.rb', line 37 def to_hash { route: @route.to_hash, actions: @actions, level: @level, before: @before_commands, after: @after_commands } end |