Class: Vintage::RequestContext

Inherits:
Object
  • Object
show all
Defined in:
lib/vintage/request_context.rb

Overview

A class that creates a context for template rendering. Helpers are mixed in here to give templates access to them.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming_request) ⇒ RequestContext

Returns a new instance of RequestContext.



23
24
25
26
# File 'lib/vintage/request_context.rb', line 23

def initialize(incoming_request)
  self.request = incoming_request
  self.response = Vintage::Response.new
end

Instance Attribute Details

#requestObject

Returns the value of attribute request.



21
22
23
# File 'lib/vintage/request_context.rb', line 21

def request
  @request
end

#responseObject

Returns the value of attribute response.



21
22
23
# File 'lib/vintage/request_context.rb', line 21

def response
  @response
end

Instance Method Details

#cookiesObject



28
29
30
# File 'lib/vintage/request_context.rb', line 28

def cookies
  self.request.cookies
end


32
33
34
# File 'lib/vintage/request_context.rb', line 32

def set_cookie(key, val)
  self.response.cookies[key] = val
end