Class: Culpa::SessionDrivers::RedisSession

Inherits:
Object
  • Object
show all
Defined in:
lib/culpa-redis.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options, session_id) ⇒ RedisSession

Returns a new instance of RedisSession.



10
11
12
13
14
15
# File 'lib/culpa-redis.rb', line 10

def initialize(options, session_id)
  @config = options
  @session_id = session_id || SecureRandom.hex
  open_redis
  load_session_copy
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args, &blk) ⇒ Object



22
23
24
# File 'lib/culpa-redis.rb', line 22

def method_missing(sym, *args, &blk)
  @session_copy.send(sym, *args, &blk)
end

Instance Attribute Details

#session_idObject (readonly)

Returns the value of attribute session_id.



8
9
10
# File 'lib/culpa-redis.rb', line 8

def session_id
  @session_id
end

Instance Method Details

#closeObject



17
18
19
20
# File 'lib/culpa-redis.rb', line 17

def close
  save_session_copy
  @redis.close
end