Class: ActionDispatch::Flash::FlashNow

Inherits:
Object
  • Object
show all
Defined in:
actionpack/lib/action_dispatch/middleware/flash.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(flash) ⇒ FlashNow

Returns a new instance of FlashNow.



85
86
87
# File 'actionpack/lib/action_dispatch/middleware/flash.rb', line 85

def initialize(flash)
  @flash = flash
end

Instance Attribute Details

#flashObject

Returns the value of attribute flash



83
84
85
# File 'actionpack/lib/action_dispatch/middleware/flash.rb', line 83

def flash
  @flash
end

Instance Method Details

#[](k) ⇒ Object



96
97
98
# File 'actionpack/lib/action_dispatch/middleware/flash.rb', line 96

def [](k)
  @flash[k.to_s]
end

#[]=(k, v) ⇒ Object



89
90
91
92
93
94
# File 'actionpack/lib/action_dispatch/middleware/flash.rb', line 89

def []=(k, v)
  k = k.to_s
  @flash[k] = v
  @flash.discard(k)
  v
end

#alert=(message) ⇒ Object

Convenience accessor for flash.now[:alert]=.



101
102
103
# File 'actionpack/lib/action_dispatch/middleware/flash.rb', line 101

def alert=(message)
  self[:alert] = message
end

#notice=(message) ⇒ Object

Convenience accessor for flash.now[:notice]=.



106
107
108
# File 'actionpack/lib/action_dispatch/middleware/flash.rb', line 106

def notice=(message)
  self[:notice] = message
end