Class: Brochure::Static

Inherits:
Object
  • Object
show all
Defined in:
lib/brochure/static.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, dir) ⇒ Static

Returns a new instance of Static.



5
6
7
8
# File 'lib/brochure/static.rb', line 5

def initialize(app, dir)
  @file = Rack::File.new(dir)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/brochure/static.rb', line 10

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