Class: Split::Persistence::SessionAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/split/persistence/session_adapter.rb

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ SessionAdapter

Returns a new instance of SessionAdapter.



7
8
9
10
# File 'lib/split/persistence/session_adapter.rb', line 7

def initialize(context)
  @session = context.session
  @session[:split] ||= {}
end

Instance Method Details

#[](key) ⇒ Object



12
13
14
# File 'lib/split/persistence/session_adapter.rb', line 12

def [](key)
  @session[:split][key]
end

#[]=(key, value) ⇒ Object



16
17
18
# File 'lib/split/persistence/session_adapter.rb', line 16

def []=(key, value)
  @session[:split][key] = value
end

#delete(key) ⇒ Object



20
21
22
# File 'lib/split/persistence/session_adapter.rb', line 20

def delete(key)
  @session[:split].delete(key)
end

#keysObject



24
25
26
# File 'lib/split/persistence/session_adapter.rb', line 24

def keys
  @session[:split].keys
end