module Rack::App::SingletonMethods::RouteHandling
Public Instance Methods
router()
click to toggle source
# File lib/rack/app/singleton_methods/route_handling.rb, line 2 def router @router ||= Rack::App::Router.new end
Protected Instance Methods
add_route(request_method, request_path, callable)
click to toggle source
# File lib/rack/app/singleton_methods/route_handling.rb, line 22 def add_route(request_method, request_path, callable) router.register_endpoint!( Rack::App::Endpoint.new(:ancestors => [self], :callable => callable, :payload => payload, :error_handler => error, :request_method => request_method, :route => route_registration_properties.dup, :endpoint_specific_middlewares => next_endpoint_middlewares.dup, :request_path => ::Rack::App::Utils.join(namespace, request_path)) ) next_endpoint_middlewares.clear route_registration_properties.clear nil end
description(*description_texts)
click to toggle source
# File lib/rack/app/singleton_methods/route_handling.rb, line 16 def description(*description_texts) route_registration_properties[:description] = description_texts.join("\n") end
Also aliased as: desc
namespace(*namespace_paths) { || ... }
click to toggle source
# File lib/rack/app/singleton_methods/route_handling.rb, line 39 def namespace(*namespace_paths) @namespaces ||= [] @namespaces.push(namespace_paths) yield if block_given? @namespaces.pop ::Rack::App::Utils.join(@namespaces.flatten) end
root(endpoint_path)
click to toggle source
# File lib/rack/app/singleton_methods/route_handling.rb, line 8 def root(endpoint_path) alias_endpoint('/', endpoint_path) end
route_registration_properties()
click to toggle source
# File lib/rack/app/singleton_methods/route_handling.rb, line 12 def route_registration_properties @route_registration_properties ||= {} end