Sha256: f3a90f28bf6f2e80d7b497d38f6c27371f698b1383577b9bac6b86b7d8b4fa77

Contents?: true

Size: 827 Bytes

Versions: 57

Compression:

Stored size: 827 Bytes

Contents

# -*- encoding : utf-8 -*-
module HydraHead
  class Routes

    def initialize(router, options)
      @router = router
      @options = options
    end

    def draw
      route_sets.each do |r|
        self.send(r)
      end
    end

    protected

    def add_routes &blk
      @router.instance_exec(@options, &blk)
    end

    def route_sets
      (@options[:only] || default_route_sets) - (@options[:except] || [])
    end

    def default_route_sets
      [:assets_with_all_nested_routes]
    end

    module RouteSets
      def assets_with_all_nested_routes
        add_routes do |options|
          namespace :hydra do
            resources :file_assets
            resources :assets do 
              resources :file_assets
            end
          end
        end
      end
    end

    include RouteSets

  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
hydra-core-5.4.1 lib/hydra-head/routes.rb
hydra-core-6.5.2 lib/hydra-head/routes.rb
hydra-core-6.5.1 lib/hydra-head/routes.rb
hydra-core-6.4.2 lib/hydra-head/routes.rb
hydra-core-6.5.0 lib/hydra-head/routes.rb
hydra-core-6.5.0.rc2 lib/hydra-head/routes.rb
hydra-core-6.4.1 lib/hydra-head/routes.rb
hydra-core-6.4.0 lib/hydra-head/routes.rb
hydra-core-6.4.0.rc5 lib/hydra-head/routes.rb
hydra-core-6.4.0.rc4 lib/hydra-head/routes.rb
hydra-core-6.4.0.rc3 lib/hydra-head/routes.rb
hydra-core-6.4.0.rc2 lib/hydra-head/routes.rb
hydra-core-6.4.0.rc1 lib/hydra-head/routes.rb
hydra-core-6.4.0.pre2 lib/hydra-head/routes.rb
hydra-core-6.4.0.pre1 lib/hydra-head/routes.rb
hydra-core-6.3.4 lib/hydra-head/routes.rb
hydra-core-6.3.3 lib/hydra-head/routes.rb
hydra-core-6.3.2 lib/hydra-head/routes.rb
hydra-core-6.3.1 lib/hydra-head/routes.rb
hydra-core-6.3.0 lib/hydra-head/routes.rb