Class: Wayfarer::Routing::Route
- Inherits:
-
Object
- Object
- Wayfarer::Routing::Route
- Extended by:
- Forwardable
- Defined in:
- lib/wayfarer/routing/route.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#matcher ⇒ Object
Returns the value of attribute matcher.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#path_offset ⇒ Object
Returns the value of attribute path_offset.
Instance Method Summary collapse
-
#accept(visitor) ⇒ Object
Accepts a visitor for in-order traversal.
-
#initialize(matcher = Matchers::Custom.new { children.any? }, path_offset = "/") ⇒ Route
constructor
A new instance of Route.
Methods included from Stringify
Methods included from DSL
#custom, #host, #path, #query, #scheme, #suffix, #to, #url
Constructor Details
#initialize(matcher = Matchers::Custom.new { children.any? }, path_offset = "/") ⇒ Route
Returns a new instance of Route.
21 22 23 24 25 |
# File 'lib/wayfarer/routing/route.rb', line 21 def initialize(matcher = Matchers::Custom.new { children.any? }, path_offset = "/") @matcher = matcher @children = [] @path_offset = path_offset end |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
12 13 14 |
# File 'lib/wayfarer/routing/route.rb', line 12 def action @action end |
#children ⇒ Object (readonly)
Returns the value of attribute children.
10 11 12 |
# File 'lib/wayfarer/routing/route.rb', line 10 def children @children end |
#matcher ⇒ Object
Returns the value of attribute matcher.
12 13 14 |
# File 'lib/wayfarer/routing/route.rb', line 12 def matcher @matcher end |
#parent ⇒ Object
Returns the value of attribute parent.
12 13 14 |
# File 'lib/wayfarer/routing/route.rb', line 12 def parent @parent end |
#path_offset ⇒ Object
Returns the value of attribute path_offset.
12 13 14 |
# File 'lib/wayfarer/routing/route.rb', line 12 def path_offset @path_offset end |
Instance Method Details
#accept(visitor) ⇒ Object
Accepts a visitor for in-order traversal.
28 29 30 31 32 |
# File 'lib/wayfarer/routing/route.rb', line 28 def accept(visitor) return unless visitor.visit(self) children.each { |child| child.accept(visitor) } end |