Class: ActionView::PathResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/workarea/ext/freedom_patches/action_view_path_resolver.rb

Instance Method Summary collapse

Instance Method Details

#find_template_paths(query) ⇒ Object



3
4
5
6
7
8
# File 'lib/workarea/ext/freedom_patches/action_view_path_resolver.rb', line 3

def find_template_paths(query)
  prefilter(query).reject do |filename|
    File.directory?(filename) ||
      !File.fnmatch(query, filename, File::FNM_EXTGLOB)
  end
end

#prefilter(query) ⇒ Object



10
11
12
13
14
# File 'lib/workarea/ext/freedom_patches/action_view_path_resolver.rb', line 10

def prefilter(query)
  path = query.split('{')[0]
  # sort by + sign to make sure that variant matches get priority
  Dir[path + '*'].uniq.sort_by { |i| i =~ /\+/ ? 0 : 1 }
end