Class: CloudKit::FlashSession

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudkit/flash_session.rb

Overview

FlashSessions are hashes that forget their contents after the first access. Useful for session-based messaging.

Instance Method Summary collapse

Constructor Details

#initializeFlashSession

Returns a new instance of FlashSession.



6
7
8
# File 'lib/cloudkit/flash_session.rb', line 6

def initialize
  @values = {}
end

Instance Method Details

#[](k) ⇒ Object

Access a value, then forget it.



16
17
18
# File 'lib/cloudkit/flash_session.rb', line 16

def [](k)
  @values.delete(k)
end

#[]=(k, v) ⇒ Object

Set the value for a key.



11
12
13
# File 'lib/cloudkit/flash_session.rb', line 11

def []=(k, v)
  @values[k] = v
end