Class: Syntax::Route
- Inherits:
-
Treetop::Runtime::SyntaxNode
- Object
- Treetop::Runtime::SyntaxNode
- Syntax::Route
- Defined in:
- lib/silicon/routing/syntax/route.rb
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#parameter ⇒ Object
readonly
Returns the value of attribute parameter.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
3 4 5 |
# File 'lib/silicon/routing/syntax/route.rb', line 3 def node @node end |
#parameter ⇒ Object (readonly)
Returns the value of attribute parameter.
3 4 5 |
# File 'lib/silicon/routing/syntax/route.rb', line 3 def parameter @parameter end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/silicon/routing/syntax/route.rb', line 3 def path @path end |
Instance Method Details
#parse(node) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/silicon/routing/syntax/route.rb', line 5 def parse(node) @node = node elements.each do |element| if element.is_a? Parameter @parameter = element.text_value end if element.is_a? Path @path = element.text_value end end self end |
#to_hash ⇒ Object
21 22 23 |
# File 'lib/silicon/routing/syntax/route.rb', line 21 def to_hash {path: @path, parameter: @parameter} end |