Class: Syntropy::NowFlash

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

Overview

NowFlash holds flash data for the current request.

Instance Method Summary collapse

Constructor Details

#initializeNowFlash

Returns a new instance of NowFlash.



100
101
102
# File 'lib/syntropy/session.rb', line 100

def initialize
  @data = {}
end

Instance Method Details

#[](key) ⇒ any

Returns the value for the given key.

Parameters:

  • key (Symbol)

Returns:

  • (any)

    flash value



108
109
110
# File 'lib/syntropy/session.rb', line 108

def [](key)
  @data[key.to_s]
end

#[]=(key, value) ⇒ any

Sets the value for the given key.

Parameters:

  • key (Symbol)
  • value (any)

Returns:

  • (any)

    value



117
118
119
# File 'lib/syntropy/session.rb', line 117

def []=(key, value)
  @data[key.to_s] = value
end

#each(&block) ⇒ void

This method returns an undefined value.

Iterates through the flash storage, yielding each key-value pair to the given block.



125
126
127
# File 'lib/syntropy/session.rb', line 125

def each(&block)
  @data.each { |k, v| block.(k.to_sym, v) }
end