Module: Pepper::App::InstanceMethods
- Defined in:
- lib/pepper.rb
Overview
The interface for Rack to connect to using the call method
Defined Under Namespace
Classes: Error404, ErrorMethodNotSupported, ErrorRootContextNotFound
Instance Method Summary
collapse
Instance Method Details
#call(rack_env) ⇒ Object
362
363
364
365
366
367
368
369
370
371
372
373
|
# File 'lib/pepper.rb', line 362
def call(rack_env)
@response=Rack::Response.new
@request=Request.new(rack_env)
raise ErrorRootContextNotFound if root.nil?
root.app=self
context = root.resolve(request.path_info_slices)
raise Error404 if context.nil?
action = context.find_action(request.method_sym, request.env)
raise ErrorMethodNotSupported if action.nil?
response.write action.execute!
response.finish
end
|
354
355
356
|
# File 'lib/pepper.rb', line 354
def (name, value)
response[name]=value
end
|
358
359
360
|
# File 'lib/pepper.rb', line 358
def (hash)
hash.each_pair {|k,v|(k,v)}
end
|
#request ⇒ Object
350
|
# File 'lib/pepper.rb', line 350
def request; @request end
|
#response ⇒ Object
352
|
# File 'lib/pepper.rb', line 352
def response; @response; end
|
#root ⇒ Object
349
|
# File 'lib/pepper.rb', line 349
def root; self.class.root end
|