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



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

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

#[]=(type, message) ⇒ Object

Since:

  • 0.10.8



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

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

#clearObject

Since:

  • 0.10.8



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

def clear
  @_now.clear
end

#delete(type) ⇒ Object

Since:

  • 0.10.8



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

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

#discard(key = nil) ⇒ Object

Since:

  • 0.10.8



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

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

#each(&block) ⇒ Object

Since:

  • 0.10.8



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

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

#empty?Boolean

Returns:

  • (Boolean)

Since:

  • 0.10.8



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

def empty?
  @_now.empty?
end

#errorObject

Since:

  • 0.10.8



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

def error
  self[:error]
end

#error=(message) ⇒ Object

Since:

  • 0.10.8



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

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

#keep(key = nil) ⇒ Object

Since:

  • 0.10.8



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

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



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

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

#keysObject

Since:

  • 0.10.8



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

def keys
  @_now.keys
end

#lengthObject Also known as: size



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

def length
  @_now.length
end

#nextObject



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

def next
  @_next
end

#noticeObject

Since:

  • 0.10.8



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

def notice
  self[:notice]
end

#notice=(message) ⇒ Object

Since:

  • 0.10.8



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

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

#nowObject



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

def now
  @_now
end

#replace(hash) ⇒ Object

Since:

  • 0.10.8



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

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

#successObject

Since:

  • 0.10.8



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

def success
  self[:success]
end

#success=(message) ⇒ Object

Since:

  • 0.10.8



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

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

#sweepObject

Since:

  • 0.10.8



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

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

#to_hashObject

Since:

  • 0.10.8



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

def to_hash
  @_now.dup
end

#to_sObject

Since:

  • 0.10.8



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

def to_s
  @_now.to_s
end

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

Since:

  • 0.10.8



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

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