module Doorkeeper::Rails::AbstractRouter

Abstract router module that implements base behavior for generating and mapping Rails routes.

Could be reused in Doorkeeper extensions.

Attributes

routes[R]

Public Class Methods

new(routes, mapper = Mapper.new, &block) click to toggle source
# File lib/doorkeeper/rails/routes/abstract_router.rb, line 15
def initialize(routes, mapper = Mapper.new, &block)
  @routes = routes
  @mapping = mapper.map(&block)
end

Public Instance Methods

generate_routes!(**_options) click to toggle source
# File lib/doorkeeper/rails/routes/abstract_router.rb, line 20
def generate_routes!(**_options)
  raise NotImplementedError, "must be redefined for #{self.class.name}!"
end

Private Instance Methods

map_route(name, method) click to toggle source
# File lib/doorkeeper/rails/routes/abstract_router.rb, line 26
def map_route(name, method)
  return if @mapping.skipped?(name)

  send(method, @mapping[name])

  mapping[name] = @mapping[name]
end