Class: ActionView::PathSet

Inherits:
Object
  • Object
show all
Defined in:
lib/altered_views/path_set_extension.rb

Instance Method Summary collapse

Instance Method Details

#find_all(*args) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/altered_views/path_set_extension.rb', line 3

def find_all(*args)
			@cache ||= {}
			call_parent = false
			
			if args[1].is_a? String and args[1] =~ /^parent:/
call_parent = true
args[1] = args[1].gsub(/^parent:/, '')
			end

			if @cache.has_key? args.hash and call_parent
list = @cache[args.hash] 
			else
   list = map do |resolver|
     templates = resolver.find_all(*args)        
   end.reject {|templates| templates.empty? }
@cache[args.hash] = list
			end
			list.empty? ? [] : list.shift
end