Class: Rack::Session::SessionId

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/session/abstract/id.rb

Direct Known Subclasses

Cookie::SessionId

Constant Summary collapse

ID_VERSION =
2

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(public_id) ⇒ SessionId

Returns a new instance of SessionId.


20
21
22
# File 'lib/rack/session/abstract/id.rb', line 20

def initialize(public_id)
  @public_id = public_id
end

Instance Attribute Details

#public_idObject (readonly) Also known as: cookie_value, to_s

Returns the value of attribute public_id


18
19
20
# File 'lib/rack/session/abstract/id.rb', line 18

def public_id
  @public_id
end

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)

31
# File 'lib/rack/session/abstract/id.rb', line 31

def empty?; false; end

#inspectObject


32
# File 'lib/rack/session/abstract/id.rb', line 32

def inspect; public_id.inspect; end

#private_idObject


24
25
26
# File 'lib/rack/session/abstract/id.rb', line 24

def private_id
  "#{ID_VERSION}::#{hash_sid(public_id)}"
end