Class: Flame::Dispatcher::Cookies
- Inherits:
-
Object
- Object
- Flame::Dispatcher::Cookies
- Defined in:
- lib/flame/cookies.rb
Overview
Helper class for cookies
Instance Method Summary collapse
-
#[](key) ⇒ Object
Get request cookies.
-
#[]=(key, new_value) ⇒ Object
Set (or delete) cookies for response.
-
#initialize(request_cookies, response) ⇒ Cookies
constructor
A new instance of Cookies.
Constructor Details
#initialize(request_cookies, response) ⇒ Cookies
Returns a new instance of Cookies.
5 6 7 8 |
# File 'lib/flame/cookies.rb', line 5 def initialize(, response) @request_cookies = @response = response end |
Instance Method Details
#[](key) ⇒ Object
Get request cookies
12 13 14 |
# File 'lib/flame/cookies.rb', line 12 def [](key) @request_cookies[key.to_s] end |
#[]=(key, new_value) ⇒ Object
Set (or delete) cookies for response
23 24 25 26 |
# File 'lib/flame/cookies.rb', line 23 def []=(key, new_value) return @response.(key.to_s, path: '/') if new_value.nil? @response.(key.to_s, value: new_value, path: '/') end |