Class: Hyperdrive::Middleware::Accept

Inherits:
Object
  • Object
show all
Defined in:
lib/hyperdrive/middleware/accept.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Accept

Returns a new instance of Accept.



6
7
8
# File 'lib/hyperdrive/middleware/accept.rb', line 6

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
# File 'lib/hyperdrive/middleware/accept.rb', line 10

def call(env)
  env['hyperdrive.accept'] = Rack::Accept::MediaType.new(env['HTTP_ACCEPT'])
  @app.call(env)
end