Sha256: 6e0b108ec2c12078773ac1c7bbb4636842ff5230c7be5bc3faabb1d13da049cc

Contents?: true

Size: 778 Bytes

Versions: 26

Compression:

Stored size: 778 Bytes

Contents

# frozen_string_literal: true

module Doorkeeper
  module Rails
    # Abstract router module that implements base behavior
    # for generating and mapping Rails routes.
    #
    # Could be reused in Doorkeeper extensions.
    #
    module AbstractRouter
      extend ActiveSupport::Concern

      attr_reader :routes

      def initialize(routes, mapper = Mapper.new, &block)
        @routes = routes
        @mapping = mapper.map(&block)
      end

      def generate_routes!(**_options)
        raise NotImplementedError, "must be redefined for #{self.class.name}!"
      end

      private

      def map_route(name, method)
        return if @mapping.skipped?(name)

        send(method, @mapping[name])

        mapping[name] = @mapping[name]
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
doorkeeper-5.8.1 lib/doorkeeper/rails/routes/abstract_router.rb
doorkeeper-5.8.0 lib/doorkeeper/rails/routes/abstract_router.rb
doorkeeper-5.7.1 lib/doorkeeper/rails/routes/abstract_router.rb
doorkeeper-5.7.0 lib/doorkeeper/rails/routes/abstract_router.rb
doorkeeper-5.6.9 lib/doorkeeper/rails/routes/abstract_router.rb
doorkeeper-5.6.8 lib/doorkeeper/rails/routes/abstract_router.rb
doorkeeper-5.6.7 lib/doorkeeper/rails/routes/abstract_router.rb
doorkeeper-5.6.6 lib/doorkeeper/rails/routes/abstract_router.rb
doorkeeper-5.6.5 lib/doorkeeper/rails/routes/abstract_router.rb
doorkeeper-5.6.4 lib/doorkeeper/rails/routes/abstract_router.rb
doorkeeper-5.6.3 lib/doorkeeper/rails/routes/abstract_router.rb
doorkeeper-5.6.2 lib/doorkeeper/rails/routes/abstract_router.rb
doorkeeper-5.6.1 lib/doorkeeper/rails/routes/abstract_router.rb
doorkeeper-5.6.0 lib/doorkeeper/rails/routes/abstract_router.rb
doorkeeper-5.6.0.rc2 lib/doorkeeper/rails/routes/abstract_router.rb
doorkeeper-5.6.0.rc1 lib/doorkeeper/rails/routes/abstract_router.rb
doorkeeper-5.5.4 lib/doorkeeper/rails/routes/abstract_router.rb
doorkeeper-5.5.3 lib/doorkeeper/rails/routes/abstract_router.rb
doorkeeper-5.5.2 lib/doorkeeper/rails/routes/abstract_router.rb
doorkeeper-5.5.1 lib/doorkeeper/rails/routes/abstract_router.rb