Module: Roda::RodaPlugins::MultiRoute::ClassMethods
- Defined in:
- lib/roda/plugins/multi_route.rb
Instance Method Summary collapse
-
#inherited(subclass) ⇒ Object
Copy the named routes into the subclass when inheriting.
-
#named_route(name) ⇒ Object
Return the named route with the given name.
-
#route(name = nil, &block) ⇒ Object
If the given route has a named, treat it as a named route and store the route block.
Instance Method Details
#inherited(subclass) ⇒ Object
Copy the named routes into the subclass when inheriting.
45 46 47 48 |
# File 'lib/roda/plugins/multi_route.rb', line 45 def inherited(subclass) super subclass.instance_variable_set(:@named_routes, @named_routes.dup) end |
#named_route(name) ⇒ Object
Return the named route with the given name.
51 52 53 |
# File 'lib/roda/plugins/multi_route.rb', line 51 def named_route(name) @named_routes[name] end |
#route(name = nil, &block) ⇒ Object
If the given route has a named, treat it as a named route and store the route block. Otherwise, this is the main route, so call super.
58 59 60 61 62 63 64 |
# File 'lib/roda/plugins/multi_route.rb', line 58 def route(name=nil, &block) if name @named_routes[name] = block else super(&block) end end |