Class: CGI::Session::DRbStore

Inherits:
Object
  • Object
show all
Defined in:
lib/action_controller/session/drb_store.rb

Constant Summary collapse

@@session_data =
DRbObject.new(nil, 'druby://localhost:9192')

Instance Method Summary collapse

Constructor Details

#initialize(session, option = nil) ⇒ DRbStore

Returns a new instance of DRbStore.



10
11
12
# File 'lib/action_controller/session/drb_store.rb', line 10

def initialize(session, option=nil)
  @session_id = session.session_id
end

Instance Method Details

#closeObject



22
23
24
# File 'lib/action_controller/session/drb_store.rb', line 22

def close
  update
end

#dataObject



30
31
32
# File 'lib/action_controller/session/drb_store.rb', line 30

def data
  @@session_data[@session_id]
end

#deleteObject



26
27
28
# File 'lib/action_controller/session/drb_store.rb', line 26

def delete
  @@session_data.delete(@session_id)
end

#restoreObject



14
15
16
# File 'lib/action_controller/session/drb_store.rb', line 14

def restore
  @h = @@session_data[@session_id] || {}
end

#updateObject



18
19
20
# File 'lib/action_controller/session/drb_store.rb', line 18

def update
  @@session_data[@session_id] = @h
end