Skip to content

Commit

Permalink
Merge pull request rails#42642 from jhawthorn/registered_details_to_ivar
Browse files Browse the repository at this point in the history
Replace cvar with ivar for registered_details
  • Loading branch information
jhawthorn authored Jun 29, 2021
2 parents c3fe14c + eeea496 commit fac3bde
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions actionview/lib/action_view/lookup_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ module ActionView
class LookupContext #:nodoc:
attr_accessor :prefixes, :rendered_format

mattr_accessor :registered_details, default: []
singleton_class.attr_accessor :registered_details
self.registered_details = []

def self.register_detail(name, &block)
registered_details << name
Expand Down Expand Up @@ -176,7 +177,7 @@ def detail_args_for_any
@detail_args_for_any ||= begin
details = {}

registered_details.each do |k|
LookupContext.registered_details.each do |k|
if k == :variants
details[k] = :any
else
Expand Down Expand Up @@ -238,7 +239,7 @@ def with_prepended_formats(formats)
end

def initialize_details(target, details)
registered_details.each do |k|
LookupContext.registered_details.each do |k|
target[k] = details[k] || Accessors::DEFAULT_PROCS[k].call
end
target
Expand Down
2 changes: 1 addition & 1 deletion actionview/lib/action_view/renderer/abstract_renderer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def format

def extract_details(options) # :doc:
details = nil
@lookup_context.registered_details.each do |key|
LookupContext.registered_details.each do |key|
value = options[key]

if value
Expand Down

0 comments on commit fac3bde

Please sign in to comment.