Module: Moped::SessionStore::Base

Included in:
Moped::SessionStore
Defined in:
lib/moped/session_store/base.rb

Instance Method Summary collapse

Instance Method Details

#collectionObject



4
5
6
# File 'lib/moped/session_store/base.rb', line 4

def collection
    @collection
end

#initialize(app, options = {}) ⇒ Object

Sets up a new instance of Moped::Session::Store



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/moped/session_store/base.rb', line 9

def initialize(app, options = {})
    
    unless options[:collection]
        raise "To avoid creating unneccessary connections to MongoDB" +
        "this Session Store will only reuse an existing Moped connection"  +
        "this behaviour WILL CHANGE in the future, but not yet"
    end
    @collection = options[:collection].respond_to?(:call) ? options[:collection].call : options[:collection]
        
    super
end