class Granite::Routing::Cache

Attributes

routes[R]

Public Class Methods

new(routes) click to toggle source
# File lib/granite/routing/cache.rb, line 6
def initialize(routes)
  @routes = routes
end

Public Instance Methods

[](action, projector) click to toggle source
# File lib/granite/routing/cache.rb, line 10
def [](action, projector)
  projector = projector.to_s
  Array(grouped_routes[action.to_s]).detect do |route|
    route.required_defaults[:granite_projector] == projector
  end
end

Private Instance Methods

grouped_routes() click to toggle source
# File lib/granite/routing/cache.rb, line 19
def grouped_routes
  @grouped_routes ||= routes.group_by { |r| r.required_defaults[:granite_action] }
end