Module: Roda::RodaPlugins::MultiRoute::RequestMethods

Defined in:
lib/roda/plugins/multi_route.rb

Instance Method Summary collapse

Instance Method Details

#multi_routeObject

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.



112
113
114
115
116
117
# File 'lib/roda/plugins/multi_route.rb', line 112

def multi_route
  on self.class.named_route_regexp do |section|
    route(section)
    yield if block_given?
  end
end

#route(name) ⇒ Object

Dispatch to the named route with the given name.



120
121
122
# File 'lib/roda/plugins/multi_route.rb', line 120

def route(name)
  scope.instance_exec(self, &self.class.roda_class.named_route(name))
end