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

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

Instance Method Summary collapse

Instance Method Details

#multi_route(namespace = nil) ⇒ Object

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.



141
142
143
144
145
146
147
148
149
150
# File 'lib/roda/plugins/multi_route.rb', line 141

def multi_route(namespace=nil)
  on self.class.named_route_regexp(namespace) do |section|
    res = route(section, namespace)
    if defined?(yield)
      yield
    else
      res
    end
  end
end