module Roda::RodaPlugins::MultiRoute::RequestMethods

  1. lib/roda/plugins/multi_route.rb

Methods

Public Instance

  1. multi_route
  2. route

Public Instance methods

multi_route (namespace=nil)

Check if the first segment in the path matches any of the current named routes. If so, call that named route. If not, do nothing. If the named route does not handle the request, and a block is given, yield to the block.

[show source]
# File lib/roda/plugins/multi_route.rb, line 197
def multi_route(namespace=nil)
  on self.class.named_route_regexp(namespace) do |section|
    r = route(section, namespace)
    if block_given?
      yield
    else
      r
    end
  end
end
route (name, namespace=nil)

Dispatch to the named route with the given name.

[show source]
# File lib/roda/plugins/multi_route.rb, line 209
def route(name, namespace=nil)
  scope.instance_exec(self, &roda_class.named_route(name, namespace))
end