mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Avoid duplication using _find_all
This commit is contained in:
parent
53e4055a75
commit
0b26cc41db
1 changed files with 7 additions and 11 deletions
|
@ -118,7 +118,7 @@ module ActionView
|
||||||
locals = locals.map(&:to_s).sort!.freeze
|
locals = locals.map(&:to_s).sort!.freeze
|
||||||
|
|
||||||
cached(key, [name, prefix, partial], details, locals) do
|
cached(key, [name, prefix, partial], details, locals) do
|
||||||
find_templates(name, prefix, partial, details, locals)
|
_find_all(name, prefix, partial, details, key, locals)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -131,6 +131,10 @@ module ActionView
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def _find_all(name, prefix, partial, details, key, locals)
|
||||||
|
find_templates(name, prefix, partial, details, locals)
|
||||||
|
end
|
||||||
|
|
||||||
delegate :caching?, to: :class
|
delegate :caching?, to: :class
|
||||||
|
|
||||||
# This is what child classes implement. No defaults are needed
|
# This is what child classes implement. No defaults are needed
|
||||||
|
@ -178,19 +182,11 @@ module ActionView
|
||||||
super()
|
super()
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_all(name, prefix = nil, partial = false, details = {}, key = nil, locals = [])
|
|
||||||
locals = locals.map(&:to_s).sort!.freeze
|
|
||||||
|
|
||||||
cached(key, [name, prefix, partial], details, locals) do
|
|
||||||
find_templates(name, prefix, partial, details, locals, cache: !!key)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def find_templates(name, prefix, partial, details, locals, cache: true)
|
def _find_all(name, prefix, partial, details, key, locals)
|
||||||
path = Path.build(name, prefix, partial)
|
path = Path.build(name, prefix, partial)
|
||||||
query(path, details, details[:formats], locals, cache: cache)
|
query(path, details, details[:formats], locals, cache: !!key)
|
||||||
end
|
end
|
||||||
|
|
||||||
def query(path, details, formats, locals, cache:)
|
def query(path, details, formats, locals, cache:)
|
||||||
|
|
Loading…
Reference in a new issue