Module: Doorkeeper::Rails::Routes::Registry
- Included in:
- Doorkeeper::Rails::Routes
- Defined in:
- lib/doorkeeper/rails/routes/registry.rb
Overview
Thread-safe registry of any Doorkeeper additional routes. Used to allow implementing of Doorkeeper extensions that must use their own routes.
Constant Summary collapse
- ROUTES_ACCESS_LOCK =
Mutex.new
- ROUTES_DEFINITION_LOCK =
Mutex.new
- InvalidRouterClass =
Class.new(StandardError)
Instance Method Summary collapse
-
#register_routes(routes) ⇒ Object
(also: #register)
Registers additional routes in the Doorkeeper registry.
-
#registered_routes ⇒ Array<Object>
Collection of additional registered routes for Doorkeeper.
Instance Method Details
#register_routes(routes) ⇒ Object Also known as: register
Registers additional routes in the Doorkeeper registry
31 32 33 34 35 36 37 38 39 |
# File 'lib/doorkeeper/rails/routes/registry.rb', line 31 def register_routes(routes) if !routes.is_a?(Module) || !(routes < AbstractRouter) raise InvalidRouterClass, "routes class must include Doorkeeper::Rails::AbstractRouter" end ROUTES_ACCESS_LOCK.synchronize do registered_routes << routes end end |
#registered_routes ⇒ Array<Object>
Collection of additional registered routes for Doorkeeper.
20 21 22 23 24 |
# File 'lib/doorkeeper/rails/routes/registry.rb', line 20 def registered_routes ROUTES_DEFINITION_LOCK.synchronize do @registered_routes ||= Set.new end end |