Module: Rack::App::InstanceMethods::Core

Included in:
Rack::App::InstanceMethods
Defined in:
lib/rack/app/instance_methods/core.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#requestObject



5
6
7
# File 'lib/rack/app/instance_methods/core.rb', line 5

def request
  @request || raise("request object is not set for #{self.class}")
end

#responseObject



9
10
11
# File 'lib/rack/app/instance_methods/core.rb', line 9

def response
  @response || raise("response object is not set for #{self.class}")
end

Instance Method Details

#respond_with(value = response) ⇒ Object Also known as: finish!



13
14
15
16
17
18
19
20
# File 'lib/rack/app/instance_methods/core.rb', line 13

def respond_with(value = response)
  case value
  when Rack::Response
    throw(:rack_response, value)
  else
    throw(:response_body, value)
  end
end