Class: Rack::Rescue::Responder

Inherits:
Object
  • Object
show all
Includes:
Pancake::Mixins::RequestHelper, Pancake::Mixins::ResponseHelper
Defined in:
lib/rack/rescue/responder.rb

Instance Method Summary collapse

Constructor Details

#initialize(env, rescuer) ⇒ Responder

Returns a new instance of Responder.



7
8
9
10
# File 'lib/rack/rescue/responder.rb', line 7

def initialize(env, rescuer)
  @rescuer = rescuer
  @env = env
end

Instance Method Details

#negotiate!(opts = {}) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/rack/rescue/responder.rb', line 12

def negotiate!(opts = {})
  negotiate_content_type!(@rescuer.formats, opts)
rescue Pancake::Errors::NotAcceptable
  mt = Pancake::MimeTypes.group(:text).first
  headers["Content-Type"] = mt.type_strings.first
  :text
end