Sha256: 93aa384390aaafb7eb3f3907971978687c10812a191390694774f2f60d283056

Contents?: true

Size: 566 Bytes

Versions: 3

Compression:

Stored size: 566 Bytes

Contents

module Para
  module Plugins
    class Routes
      attr_reader :router

      def initialize(router)
        @router = router
      end

      def plugin(identifier, &block)
        # Store router reference in closure to allow accessing it from
        # inside the below block
        router = self.router

        router.instance_eval do
          namespace :admin do
            scope module: [:para, identifier].join('/').to_sym, as: identifier do
              router.instance_eval(&block)
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
para-0.5.4 lib/para/plugins/routes.rb
para-0.5.3 lib/para/plugins/routes.rb
para-0.5.1 lib/para/plugins/routes.rb