Methods
C
E
M
N
U
Class Public methods
new(root, cache_control)
   # File actionpack/lib/action_dispatch/middleware/static.rb, line 5
5:     def initialize(root, cache_control)
6:       @root          = root.chomp('/')
7:       @compiled_root = /^#{Regexp.escape(root)}/
8:       @file_server   = ::Rack::File.new(@root, cache_control)
9:     end
Instance Public methods
call(env)
    # File actionpack/lib/action_dispatch/middleware/static.rb, line 25
25:     def call(env)
26:       @file_server.call(env)
27:     end
escape_glob_chars(path)
    # File actionpack/lib/action_dispatch/middleware/static.rb, line 40
40:     def escape_glob_chars(path)
41:       path.force_encoding('binary') if path.respond_to? :force_encoding
42:       path.gsub(/[*?{}\[\]]/, "\\\\\\&")
43:     end
ext()
    # File actionpack/lib/action_dispatch/middleware/static.rb, line 29
29:     def ext
30:       @ext ||= begin
31:         ext = ::ActionController::Base.page_cache_extension
32:         "{,#{ext},/index#{ext}}"
33:       end
34:     end
match?(path)
    # File actionpack/lib/action_dispatch/middleware/static.rb, line 11
11:     def match?(path)
12:       path = path.dup
13: 
14:       full_path = path.empty? ? @root : File.join(@root, escape_glob_chars(unescape_path(path)))
15:       paths = "#{full_path}#{ext}"
16: 
17:       matches = Dir[paths]
18:       match = matches.detect { |m| File.file?(m) }
19:       if match
20:         match.sub!(@compiled_root, '')
21:         ::Rack::Utils.escape(match)
22:       end
23:     end
unescape_path(path)
    # File actionpack/lib/action_dispatch/middleware/static.rb, line 36
36:     def unescape_path(path)
37:       URI.parser.unescape(path)
38:     end