instance method query

Ruby on Rails 3.0.20

Since v3.0.20 Last seen in v3.0.20 Private

Signature

query(path, exts, formats)

No documentation comment.

Parameters

path req
exts req
formats req
Source
# File actionpack/lib/action_view/template/resolver.rb, line 65
    def query(path, exts, formats)
      query = escape_entry File.join(@path, path)

      exts.each do |ext|
        query << '{' << ext.map {|e| e && ".#{e}" }.join(',') << ',}'
      end

      query.gsub!(/\{\.html,/, "{.html,.text.html,")
      query.gsub!(/\{\.text,/, "{.text,.text.plain,")

      templates = []
      sanitizer = Hash.new { |h,k| h[k] = Dir["#{File.dirname(k)}/*"] }

      Dir[query].each do |p|
        next if File.directory?(p) || !sanitizer[p].include?(p)

        handler, format = extract_handler_and_format(p, formats)
        contents = File.open(p, "rb") {|io| io.read }

        templates << Template.new(contents, File.expand_path(p), handler,
          :virtual_path => path, :format => format)
      end

      templates
    end

Defined in actionpack/lib/action_view/template/resolver.rb line 65 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionView::PathResolver

Type at least 2 characters to search.

↑↓ navigate · open · esc close