Sha256: d5e8882c6670216f3b8329a35b383e089e3ce66b77b9af1428931fc3109624da

Contents?: true

Size: 867 Bytes

Versions: 4

Compression:

Stored size: 867 Bytes

Contents

module PageEngine
  class RoutesFinder
    def self.available
      available = {}

      Rails.application.routes.routes.each do |route|
        unless route.requirements.empty?
          unless ['DELETE'].include?(route.verb.to_s) || route.requirements[:controller].match(/^admin.*/) || ['delete', :delete].include?(route.requirements[:method].to_s)
            available[route.requirements[:controller]] = [] unless available[route.requirements[:controller]]
            unless route.requirements[:controller] == 'pages' && route.requirements[:action] == 'show'
              available[route.requirements[:controller]] << route.requirements[:action] unless available[route.requirements[:controller]].include?(route.requirements[:action])
            end
          end

        end
      end

      available.delete('rails/info')
      available
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
page_engine-0.0.4 lib/page_engine/routes_finder.rb
page_engine-0.0.3 lib/page_engine/routes_finder.rb
page_engine-0.0.2 lib/page_engine/routes_finder.rb
page_engine-0.0.1 lib/page_engine/routes_finder.rb