Sha256: 7bae7d0502dbd211980b5a057a1c2ec4be121c3fb3ced49f139d1b427aecd30f

Contents?: true

Size: 800 Bytes

Versions: 3

Compression:

Stored size: 800 Bytes

Contents

# -*- encoding : utf-8 -*-
module BlacklightMarc
  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
      [:catalog]
    end

    module RouteSets
      def catalog
        add_routes do |options|
          # Catalog stuff.
          get 'catalog/:id/librarian_view', :to => "catalog#librarian_view", :as => "librarian_view_catalog"
          get "catalog/endnote"
          
        end
      end
   end
   
  include RouteSets
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
blacklight_marc-0.0.9 lib/blacklight_marc/routes.rb
blacklight_marc-0.0.8 lib/blacklight_marc/routes.rb
blacklight_marc-0.0.7 lib/blacklight_marc/routes.rb