Sha256: 15397c7cd1c922b59068f85140244cad2c3f680f2ebe44271d8195fda5f6a5ce

Contents?: true

Size: 333 Bytes

Versions: 2

Compression:

Stored size: 333 Bytes

Contents

module Schnitzelpress
  class Static
    def initialize(app, public_dir = './public')
      @file = Rack::File.new(public_dir)
      @app = app
    end

    def call(env)
      status, headers, body = @file.call(env)
      if status > 400
        @app.call(env)
      else
        [status, headers, body]
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
schnitzelpress-0.2.1 lib/schnitzelpress/static.rb
schnitzelpress-0.2.0 lib/schnitzelpress/static.rb