Class: Split::Persistence::CookieAdapter
- Inherits:
-
Object
- Object
- Split::Persistence::CookieAdapter
- Defined in:
- lib/split/persistence/cookie_adapter.rb
Constant Summary collapse
- EXPIRES =
One year from now
Time.now + 31536000
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #delete(key) ⇒ Object
-
#initialize(context) ⇒ CookieAdapter
constructor
A new instance of CookieAdapter.
- #keys ⇒ Object
Constructor Details
#initialize(context) ⇒ CookieAdapter
Returns a new instance of CookieAdapter.
9 10 11 |
# File 'lib/split/persistence/cookie_adapter.rb', line 9 def initialize(context) @cookies = context.send(:cookies) end |
Instance Method Details
#[](key) ⇒ Object
13 14 15 |
# File 'lib/split/persistence/cookie_adapter.rb', line 13 def [](key) hash[key] end |
#[]=(key, value) ⇒ Object
17 18 19 |
# File 'lib/split/persistence/cookie_adapter.rb', line 17 def []=(key, value) (hash.merge(key => value)) end |
#delete(key) ⇒ Object
21 22 23 |
# File 'lib/split/persistence/cookie_adapter.rb', line 21 def delete(key) (hash.tap { |h| h.delete(key) }) end |
#keys ⇒ Object
25 26 27 |
# File 'lib/split/persistence/cookie_adapter.rb', line 25 def keys hash.keys end |