Class: Padrino::Flash::Storage

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
padrino-core/lib/padrino-core/application/flash.rb

Instance Method Summary collapse

Instance Method Details

#[](type) ⇒ Object

Since:

  • 0.10.8



32
33
34
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 32

def [](type)
  @_now[type]
end

#[]=(type, message) ⇒ Object

Since:

  • 0.10.8



38
39
40
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 38

def []=(type, message)
  @_next[type] = message
end

#clearObject

Since:

  • 0.10.8



114
115
116
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 114

def clear
  @_now.clear
end

#delete(type) ⇒ Object

Since:

  • 0.10.8



44
45
46
47
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 44

def delete(type)
  @_now.delete(type)
  self
end

#discard(key = nil) ⇒ Object

Since:

  • 0.10.8



103
104
105
106
107
108
109
110
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 103

def discard(key = nil)
  if key
    @_next.delete(key)
  else
    @_next = {}
  end
  self
end

#each(&block) ⇒ Object

Since:

  • 0.10.8



63
64
65
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 63

def each(&block)
  @_now.each(&block)
end

#empty?Boolean

Returns:

  • (Boolean)

Since:

  • 0.10.8



120
121
122
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 120

def empty?
  @_now.empty?
end

#errorObject

Since:

  • 0.10.8



149
150
151
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 149

def error
  self[:error]
end

#error=(message) ⇒ Object

Since:

  • 0.10.8



143
144
145
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 143

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

#keep(key = nil) ⇒ Object

Since:

  • 0.10.8



92
93
94
95
96
97
98
99
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 92

def keep(key = nil)
  if key
    @_next[key] = @_now[key]
  else
    @_next.merge!(@_now)
  end
  self
end

#key?(type) ⇒ Boolean

Returns:

  • (Boolean)

Since:

  • 0.10.8



57
58
59
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 57

def key?(type)
  @_now.key?(type)
end

#keysObject

Since:

  • 0.10.8



51
52
53
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 51

def keys
  @_now.keys
end

#lengthObject Also known as: size



130
131
132
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 130

def length
  @_now.length
end

#nextObject



26
27
28
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 26

def next
  @_next
end

#noticeObject

Since:

  • 0.10.8



161
162
163
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 161

def notice
  self[:notice]
end

#notice=(message) ⇒ Object

Since:

  • 0.10.8



155
156
157
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 155

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

#nowObject



22
23
24
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 22

def now
  @_now
end

#replace(hash) ⇒ Object

Since:

  • 0.10.8



69
70
71
72
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 69

def replace(hash)
  @_now.replace(hash)
  self
end

#successObject

Since:

  • 0.10.8



173
174
175
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 173

def success
  self[:success]
end

#success=(message) ⇒ Object

Since:

  • 0.10.8



167
168
169
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 167

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

#sweepObject

Since:

  • 0.10.8



84
85
86
87
88
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 84

def sweep
  @_now.replace(@_next)
  @_next = {}
  self
end

#to_hashObject

Since:

  • 0.10.8



126
127
128
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 126

def to_hash
  @_now.dup
end

#to_sObject

Since:

  • 0.10.8



137
138
139
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 137

def to_s
  @_now.to_s
end

#update(hash) ⇒ Object Also known as: merge!

Since:

  • 0.10.8



76
77
78
79
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 76

def update(hash)
  @_now.update(hash)
  self
end