Class: Userbin::CookieStore::Base
- Inherits:
-
Object
- Object
- Userbin::CookieStore::Base
- Defined in:
- lib/userbin/support/cookie_store.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
-
#initialize(request, response) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(request, response) ⇒ Base
Returns a new instance of Base.
4 5 6 7 |
# File 'lib/userbin/support/cookie_store.rb', line 4 def initialize(request, response) @request = request @response = response end |
Instance Method Details
#[](key) ⇒ Object
9 10 11 |
# File 'lib/userbin/support/cookie_store.rb', line 9 def [](key) @request.[key] end |
#[]=(key, value) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/userbin/support/cookie_store.rb', line 13 def []=(key, value) @request.[key] = value if value @response.(key, value: value, expires: Time.now + (20 * 365 * 24 * 60 * 60), path: '/') else @response.(key) end end |