Sha256: 734243f9b74fdabede96f7a3c14cc7df9306cbeaac8ec3ce98161fdd8fdf34c0

Contents?: true

Size: 321 Bytes

Versions: 6

Compression:

Stored size: 321 Bytes

Contents

require 'rack/file'

module Brochure
  class Static
    def initialize(app, dir)
      @file = Rack::File.new(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

6 entries across 6 versions & 1 rubygems

Version Path
brochure-0.5.4 lib/brochure/static.rb
brochure-0.5.3 lib/brochure/static.rb
brochure-0.5.2 lib/brochure/static.rb
brochure-0.5.1 lib/brochure/static.rb
brochure-0.5.0 lib/brochure/static.rb
brochure-0.4.0 lib/brochure/static.rb