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

Instance Method Summary collapse

Instance Attribute Details

#cacheObject

Returns the value of attribute cache.



80
81
82
# File 'lib/action_view/lookup_context.rb', line 80

def cache
  @cache
end

Instance Method Details

#details_keyObject

Calculate the details key. Remove the handlers from calculation to improve performance since the user cannot modify it explicitly.



84
85
86
# File 'lib/action_view/lookup_context.rb', line 84

def details_key #:nodoc:
  @details_key ||= DetailsKey.get(@details) if @cache
end

#disable_cacheObject

Temporary skip passing the details_key forward.



89
90
91
92
93
94
# File 'lib/action_view/lookup_context.rb', line 89

def disable_cache
  old_value, @cache = @cache, false
  yield
ensure
  @cache = old_value
end