Class: Schreihals::Static

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

Instance Method Summary collapse

Constructor Details

#initialize(app, public_dir = './public') ⇒ Static

Returns a new instance of Static.



3
4
5
6
# File 'lib/schreihals/static.rb', line 3

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

Instance Method Details

#call(env) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/schreihals/static.rb', line 8

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