Module: ActionView::LookupContext::DetailsCache
- Included in:
- ActionView::LookupContext
- Defined in:
- lib/action_view/lookup_context.rb
Overview
Add caching behavior on top of Details.
Instance Attribute Summary collapse
-
#cache ⇒ Object
Returns the value of attribute cache.
Instance Method Summary collapse
-
#details_key ⇒ Object
Calculate the details key.
-
#disable_cache ⇒ Object
Temporary skip passing the details_key forward.
Instance Attribute Details
#cache ⇒ Object
Returns the value of attribute cache.
98 99 100 |
# File 'lib/action_view/lookup_context.rb', line 98 def cache @cache end |
Instance Method Details
#details_key ⇒ Object
Calculate the details key. Remove the handlers from calculation to improve performance since the user cannot modify it explicitly.
102 103 104 |
# File 'lib/action_view/lookup_context.rb', line 102 def details_key #:nodoc: @details_key ||= DetailsKey.details_cache_key(@details) if @cache end |
#disable_cache ⇒ Object
Temporary skip passing the details_key forward.
107 108 109 110 111 112 |
# File 'lib/action_view/lookup_context.rb', line 107 def disable_cache old_value, @cache = @cache, false yield ensure @cache = old_value end |