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.



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

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

Instance Method Details

#[](key) ⇒ Object



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

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

#[]=(key, value) ⇒ Object



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

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

#delete(key) ⇒ Object



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

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

#keysObject



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

def keys
  @session[:split].keys
end