aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-11-25 22:16:51 -0200
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-11-25 22:16:51 -0200
commitd3c3a9161bce6e27dc807266f8ab129723a96b2b (patch)
tree5489f05a5f217f6a5c0e3d27ee1f3a67331fb1c9
parent2f8be7ebafcf7815f9f3ec7983789157525a60fa (diff)
parent6dd0dc3e7217f8af7877c5831b3d8816d156f21e (diff)
downloadrails-d3c3a9161bce6e27dc807266f8ab129723a96b2b.tar.gz
rails-d3c3a9161bce6e27dc807266f8ab129723a96b2b.tar.bz2
rails-d3c3a9161bce6e27dc807266f8ab129723a96b2b.zip
Merge pull request #17728 from jcutrell/jcutrell/docs-to_session_value-for-pr
Adding simple docs for ActionDispatch::Flash::FlashHash#to_session_value
-rw-r--r--actionpack/lib/action_dispatch/middleware/flash.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/flash.rb b/actionpack/lib/action_dispatch/middleware/flash.rb
index 7a91674c3c..a7f95150a4 100644
--- a/actionpack/lib/action_dispatch/middleware/flash.rb
+++ b/actionpack/lib/action_dispatch/middleware/flash.rb
@@ -79,7 +79,7 @@ module ActionDispatch
class FlashHash
include Enumerable
- def self.from_session_value(value)
+ def self.from_session_value(value) #:nodoc:
flash = case value
when FlashHash # Rails 3.1, 3.2
new(value.instance_variable_get(:@flashes), value.instance_variable_get(:@used))
@@ -91,8 +91,11 @@ module ActionDispatch
flash.tap(&:sweep)
end
-
- def to_session_value
+
+ # Builds a hash containing the discarded values and the hashes
+ # representing the flashes.
+ # If there are no values in @flashes, returns nil.
+ def to_session_value #:nodoc:
return nil if empty?
{'discard' => @discard.to_a, 'flashes' => @flashes}
end