Class: Rack::AcceptDefault

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/accept_default.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, default = '*/*') ⇒ AcceptDefault

Returns a new instance of AcceptDefault.



3
4
5
6
# File 'lib/rack/accept_default.rb', line 3

def initialize(app, default='*/*')
  @app = app
  @default = default
end

Instance Method Details

#call(env) ⇒ Object



8
9
10
11
# File 'lib/rack/accept_default.rb', line 8

def call(env)
  env['HTTP_ACCEPT'] ||= @default
  @app.call(env)
end