Class: Split::Persistence::CookieAdapter
- Inherits:
-
Object
- Object
- Split::Persistence::CookieAdapter
- Defined in:
- lib/split/persistence/cookie_adapter.rb
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.
8 9 10 11 12 13 |
# File 'lib/split/persistence/cookie_adapter.rb', line 8 def initialize(context) @context = context @request, @response = context.request, context.response @cookies = @request. @expires = Time.now + end |
Instance Method Details
#[](key) ⇒ Object
15 16 17 |
# File 'lib/split/persistence/cookie_adapter.rb', line 15 def [](key) hash[key.to_s] end |
#[]=(key, value) ⇒ Object
19 20 21 |
# File 'lib/split/persistence/cookie_adapter.rb', line 19 def []=(key, value) (hash.merge!(key.to_s => value)) end |
#delete(key) ⇒ Object
23 24 25 |
# File 'lib/split/persistence/cookie_adapter.rb', line 23 def delete(key) (hash.tap { |h| h.delete(key.to_s) }) end |
#keys ⇒ Object
27 28 29 |
# File 'lib/split/persistence/cookie_adapter.rb', line 27 def keys hash.keys end |