Class: Session
- Inherits:
-
Object
show all
- Defined in:
- lib/culpa/session.rb
Overview
This is the decorator class against Session drivers
Instance Method Summary
collapse
Constructor Details
#initialize(backend, options, session_id) ⇒ Session
Returns a new instance of Session.
6
7
8
|
# File 'lib/culpa/session.rb', line 6
def initialize(backend, options, session_id)
@backend = Culpa::SessionDrivers.const_get(backend).new(options, session_id)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &blk) ⇒ Object
23
24
25
|
# File 'lib/culpa/session.rb', line 23
def method_missing(sym, *args, &blk)
@backend.send(sym, *args, &blk)
end
|
Instance Method Details
#close ⇒ Object
10
11
12
|
# File 'lib/culpa/session.rb', line 10
def close
@backend.close if @backend.respond_to? :close
end
|
#has_keys?(*keys) ⇒ Boolean
18
19
20
21
|
# File 'lib/culpa/session.rb', line 18
def has_keys?(*keys)
keys.each { |key| return false unless @backend.has_key?(key) }
true
end
|
#id ⇒ Object
14
15
16
|
# File 'lib/culpa/session.rb', line 14
def id
@backend.session_id
end
|