Module: ActionView::LookupContext::DetailsCache

Included in:
ActionView::LookupContext
Defined in:
actionview/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



99
100
101
# File 'actionview/lib/action_view/lookup_context.rb', line 99

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.



103
104
105
# File 'actionview/lib/action_view/lookup_context.rb', line 103

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

#disable_cacheObject

Temporary skip passing the details_key forward.



108
109
110
111
112
113
# File 'actionview/lib/action_view/lookup_context.rb', line 108

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