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

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

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(by, default_options) ⇒ Options

Returns a new instance of Options.



43
44
45
46
# File 'lib/action_dispatch/request/session.rb', line 43

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

Class Method Details

.find(req) ⇒ Object



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

def self.find(req)
  req.get_header ENV_SESSION_OPTIONS_KEY
end

.set(req, options) ⇒ Object



35
36
37
# File 'lib/action_dispatch/request/session.rb', line 35

def self.set(req, options)
  req.set_header ENV_SESSION_OPTIONS_KEY, options
end

Instance Method Details

#[](key) ⇒ Object



48
49
50
# File 'lib/action_dispatch/request/session.rb', line 48

def [](key)
  @delegate[key]
end

#[]=(k, v) ⇒ Object



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

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

#id(req) ⇒ Object



52
53
54
55
56
# File 'lib/action_dispatch/request/session.rb', line 52

def id(req)
  @delegate.fetch(:id) {
    @by.send(:extract_session_id, req)
  }
end

#to_hashObject



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

def to_hash;          @delegate.dup; end

#values_at(*args) ⇒ Object



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

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