Class: Syntax::Action
- Inherits:
-
Treetop::Runtime::SyntaxNode
- Object
- Treetop::Runtime::SyntaxNode
- Syntax::Action
- Defined in:
- lib/silicon/routing/syntax/action.rb
Instance Attribute Summary collapse
-
#commands ⇒ Object
readonly
Returns the value of attribute commands.
-
#http_verb ⇒ Object
readonly
Returns the value of attribute http_verb.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#respond ⇒ Object
readonly
Returns the value of attribute respond.
Instance Method Summary collapse
Instance Attribute Details
#commands ⇒ Object (readonly)
Returns the value of attribute commands.
3 4 5 |
# File 'lib/silicon/routing/syntax/action.rb', line 3 def commands @commands end |
#http_verb ⇒ Object (readonly)
Returns the value of attribute http_verb.
3 4 5 |
# File 'lib/silicon/routing/syntax/action.rb', line 3 def http_verb @http_verb end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
3 4 5 |
# File 'lib/silicon/routing/syntax/action.rb', line 3 def node @node end |
#respond ⇒ Object (readonly)
Returns the value of attribute respond.
3 4 5 |
# File 'lib/silicon/routing/syntax/action.rb', line 3 def respond @respond end |
Instance Method Details
#parse(node) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/silicon/routing/syntax/action.rb', line 5 def parse(node) @node = node @commands = [] elements.each do |element| if element.is_a? HttpVerb @http_verb = element.text_value end if element.is_a? Commands @commands = element.parse end if element.is_a? Respond @respond = element.parse end end self end |
#to_hash ⇒ Object
26 27 28 |
# File 'lib/silicon/routing/syntax/action.rb', line 26 def to_hash {http_verb: @http_verb, commands: @commands, view: @respond.view, http_status: @respond.http_status} end |