module Roda::RodaPlugins::HashRoutes::RequestMethods
def hash_branches(namespace=matched_path)
Checks the matching hash_branch namespace for a branch matching the next
def hash_branches(namespace=matched_path) rp = @remaining_path return unless rp.getbyte(0) == 47 # "/" if routes = roda_class.opts[:hash_branches][namespace] if segment_end = rp.index('/', 1) if meth = routes[rp[0, segment_end]] @remaining_path = rp[segment_end, 100000000] always{scope.send(meth, self)} end elsif meth = routes[rp] @remaining_path = '' always{scope.send(meth, self)} end end end
def hash_paths(namespace=matched_path)
Checks the matching hash_path namespace for a branch matching the
def hash_paths(namespace=matched_path) if (routes = roda_class.opts[:hash_paths][namespace]) && (meth = routes[@remaining_path]) @remaining_path = '' always{scope.send(meth, self)} end end
def hash_routes(namespace=matched_path)
Check for matches in both the hash_path and hash_branch namespaces for
def hash_routes(namespace=matched_path) hash_paths(namespace) hash_branches(namespace) end