1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
3cfd6d1 added lots of `**` and then 3f27aa8 has reverted unnecessary
changes. `save_block_result_to_cache` is also unnecessary to take
keyword arguments.
This commit is contained in:
Ryuta Kamizono 2020-05-05 18:16:48 +09:00
parent 0eebfaef87
commit a5d1628c79

View file

@ -314,7 +314,7 @@ module ActiveSupport
# :bar
# end
# cache.fetch('foo') # => "bar"
def fetch(name, options = nil)
def fetch(name, options = nil, &block)
if block_given?
options = merged_options(options)
key = normalize_key(name, options)
@ -331,7 +331,7 @@ module ActiveSupport
if entry
get_entry_value(entry, name, options)
else
save_block_result_to_cache(name, **options) { |_name| yield _name }
save_block_result_to_cache(name, options, &block)
end
elsif options && options[:force]
raise ArgumentError, "Missing block: Calling `Cache#fetch` with `force: true` requires a block."
@ -736,7 +736,7 @@ module ActiveSupport
entry.value
end
def save_block_result_to_cache(name, **options)
def save_block_result_to_cache(name, options)
result = instrument(:generate, name, options) do
yield(name)
end