Class: Granite::Routing::Cache
- Inherits:
-
Object
- Object
- Granite::Routing::Cache
- Defined in:
- lib/granite/routing/cache.rb
Instance Attribute Summary collapse
-
#routes ⇒ Object
readonly
Returns the value of attribute routes.
Instance Method Summary collapse
- #[](action, projector) ⇒ Object
-
#initialize(routes) ⇒ Cache
constructor
A new instance of Cache.
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
#routes ⇒ Object (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 |