Class: Granite::Routing::Cache

Inherits:
Object
  • Object
show all
Defined in:
lib/granite/routing/cache.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(routes) ⇒ Cache

Returns a new instance of Cache.



6
7
8
# File 'lib/granite/routing/cache.rb', line 6

def initialize(routes)
  @routes = routes
end

Instance Attribute Details

#routesObject (readonly)

Returns the value of attribute routes.



4
5
6
# File 'lib/granite/routing/cache.rb', line 4

def routes
  @routes
end

Instance Method Details

#[](action, projector) ⇒ Object



10
11
12
13
14
15
# 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