Module: Rack::Session::File

Defined in:
lib/rack/session/file.rb,
lib/rack/session/file/yaml.rb,
lib/rack/session/file/pstore.rb,
lib/rack/session/file/marshal.rb,
lib/rack/session/file/abstract.rb

Defined Under Namespace

Classes: Abstract, InvalidSessionIDError, Marshal, PStore, YAML

Constant Summary collapse

VERSION =
'0.5.0'

Class Method Summary collapse

Class Method Details

.new(app, options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rack/session/file.rb', line 12

def self.new(app, options = {})
  mapping = {
    :pstore  => :PStore,
    :yaml    => :YAML,
    :marshal => :Marshal,
  }

  driver = options.delete(:driver) || :pstore
  driver = mapping[driver.to_s.downcase.to_sym] || driver if driver.is_a?(Symbol)
  if ! driver.is_a?(Class)
    require autoload?(driver) if autoload?(driver)
    driver = const_get(driver)
  end

  return driver.new(app, options)
end