Sha256: a2fc99c34ff5c19b1c3fdee69a933c84d89960954d0ed6b325e3779544a87b4a

Contents?: true

Size: 928 Bytes

Versions: 1

Compression:

Stored size: 928 Bytes

Contents

module Pancake
  class Stack
    class Router < Pancake::Router; end
    inheritable_inner_classes :Router

    class_inheritable_accessor :_router

    @_router = self::Router.new

    # Resets the router to use the stacks namespaced router.
    # This allows a router to mixin a module, and have that module
    # mixed in to child stacks/routers.  Effectively, this will reset the scope of inheritance so that a stack type can have particular route helpers
    #
    # When the router is rest, any routes declared in parent stacks will be lost.
    # @example
    #   MyStack.reset_router! # => Replaces the current router with MyStack::Router (instance)
    #
    # @api public
    def self.reset_router!
      self._router = self::Router.new
    end

    def self.router
      yield _router if block_given?
      _router
    end

    def self.with_router
      yield router if block_given?
      router
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pancake-0.1.10 lib/pancake/stack/router.rb