Sha256: 0366d0fa87527105ba0d77311ed1b4a6f17f781946dca8ce894bdaf7e89d8580

Contents?: true

Size: 492 Bytes

Versions: 3

Compression:

Stored size: 492 Bytes

Contents

module HyperAdmin
  class Router
    def initialize(application)
      @application = application
    end

    def apply(rails_router)
      define_resource_routes rails_router
    end

    private

    def define_resource_routes(router)
      router.instance_exec @application.resources do |_resources|
        self.namespace 'admin' do
          _resources.each do |resource|
            self.resources resource.resource_name.route_key
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hyper_admin-0.4.0 lib/hyper_admin/router.rb
hyper_admin-0.3.0 lib/hyper_admin/router.rb
hyper_admin-0.2.0 lib/hyper_admin/router.rb