Class: ActionDispatch::Journey::Visitors::FormatBuilder
- Defined in:
- lib/action_dispatch/journey/visitors.rb
Overview
:nodoc:
Constant Summary
Constants inherited from Visitor
Instance Method Summary collapse
- #accept(node) ⇒ Object
- #binary(node) ⇒ Object
- #terminal(node) ⇒ Object
- #visit_GROUP(n) ⇒ Object
- #visit_STAR(n) ⇒ Object
- #visit_SYMBOL(n) ⇒ Object
Instance Method Details
#accept(node) ⇒ Object
134 |
# File 'lib/action_dispatch/journey/visitors.rb', line 134 def accept(node); Journey::Format.new(super); end |
#binary(node) ⇒ Object
137 138 139 |
# File 'lib/action_dispatch/journey/visitors.rb', line 137 def binary(node) visit(node.left) + visit(node.right) end |
#terminal(node) ⇒ Object
135 |
# File 'lib/action_dispatch/journey/visitors.rb', line 135 def terminal(node); [node.left]; end |
#visit_GROUP(n) ⇒ Object
141 |
# File 'lib/action_dispatch/journey/visitors.rb', line 141 def visit_GROUP(n); [Journey::Format.new(unary(n))]; end |
#visit_STAR(n) ⇒ Object
143 144 145 |
# File 'lib/action_dispatch/journey/visitors.rb', line 143 def visit_STAR(n) [Journey::Format.required_path(n.left.to_sym)] end |
#visit_SYMBOL(n) ⇒ Object
147 148 149 150 151 152 153 154 |
# File 'lib/action_dispatch/journey/visitors.rb', line 147 def visit_SYMBOL(n) symbol = n.to_sym if symbol == :controller [Journey::Format.required_path(symbol)] else [Journey::Format.required_segment(symbol)] end end |