Sha256: e2a58b9e0c383e038bf7aeb8e7f97c62c620603f5efcae15c326dfd365fffb93

Contents?: true

Size: 465 Bytes

Versions: 4

Compression:

Stored size: 465 Bytes

Contents

module Mack
  class Static < Rack::Static # :nodoc:
    
    def call(env)
      path = env["PATH_INFO"]
      can_serve = @urls.any? { |url| path.index(url) == 0 }

      if can_serve
        res = @file_server.call(env)
        # This is the BIG difference between Mack::Static and Rack::Static:
        return @app.call(env) if res.nil? || res[0] == 404
        return res
      else
        return @app.call(env)
      end
    end
    
  end # Static
end # Mack

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mack-0.8.1 lib/mack/utils/static.rb
mack-0.8.2 lib/mack/utils/static.rb
mack-0.8.3 lib/mack/utils/static.rb
mack-0.8.3.1 lib/mack/utils/static.rb