mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Follow up to 3f27aa8cdf
3cfd6d1
added lots of `**` and then3f27aa8
has reverted unnecessary changes. `save_block_result_to_cache` is also unnecessary to take keyword arguments.
This commit is contained in:
parent
0eebfaef87
commit
a5d1628c79
1 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue