123456789_123456789_123456789_123456789_123456789_

Module: ActionView::LookupContext::DetailsCache

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: actionview/lib/action_view/lookup_context.rb

Overview

Add caching behavior on top of Details.

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#cache (rw)

[ GitHub ]

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

attr_accessor :cache

Instance Method Details

#_set_detail(key, value) (private)

[ GitHub ]

  
# File 'actionview/lib/action_view/lookup_context.rb', line 116

def _set_detail(key, value) # :doc:
  @details = @details.dup if @digest_cache || @details_key
  @digest_cache = nil
  @details_key = nil
  @details[key] = value
end

#details_key

This method is for internal use only.

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

[ GitHub ]

  
# 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_cache

Temporary skip passing the details_key forward.

[ GitHub ]

  
# File 'actionview/lib/action_view/lookup_context.rb', line 108

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