Class: ActionDispatch::Request::Session::Options

Inherits:
Object
  • Object
show all
Defined in:
actionpack/lib/action_dispatch/request/session.rb

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(by, env, default_options) ⇒ Options

Returns a new instance of Options


37
38
39
40
41
# File 'actionpack/lib/action_dispatch/request/session.rb', line 37

def initialize(by, env, default_options)
  @by       = by
  @env      = env
  @delegate = default_options.dup
end

Class Method Details

.find(env) ⇒ Object


33
34
35
# File 'actionpack/lib/action_dispatch/request/session.rb', line 33

def self.find(env)
  env[ENV_SESSION_OPTIONS_KEY]
end

.set(env, options) ⇒ Object


29
30
31
# File 'actionpack/lib/action_dispatch/request/session.rb', line 29

def self.set(env, options)
  env[ENV_SESSION_OPTIONS_KEY] = options
end

Instance Method Details

#[](key) ⇒ Object


43
44
45
46
47
48
49
50
51
# File 'actionpack/lib/action_dispatch/request/session.rb', line 43

def [](key)
  if key == :id
    @delegate.fetch(key) {
      @delegate[:id] = @by.send(:extract_session_id, @env)
    }
  else
    @delegate[key]
  end
end

#[]=(k, v) ⇒ Object


53
# File 'actionpack/lib/action_dispatch/request/session.rb', line 53

def []=(k,v);         @delegate[k] = v; end

#to_hashObject


54
# File 'actionpack/lib/action_dispatch/request/session.rb', line 54

def to_hash;          @delegate.dup; end

#values_at(*args) ⇒ Object


55
# File 'actionpack/lib/action_dispatch/request/session.rb', line 55

def values_at(*args); @delegate.values_at(*args); end