Skip to content

Commit

Permalink
Merge pull request #17728 from jcutrell/jcutrell/docs-to_session_valu…
Browse files Browse the repository at this point in the history
…e-for-pr

Adding simple docs for ActionDispatch::Flash::FlashHash#to_session_value
  • Loading branch information
rafaelfranca committed Nov 26, 2014
2 parents 2f8be7e + 6dd0dc3 commit d3c3a91
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions actionpack/lib/action_dispatch/middleware/flash.rb
Expand Up @@ -79,7 +79,7 @@ def notice=(message)
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))
Expand All @@ -91,8 +91,11 @@ def self.from_session_value(value)

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
Expand Down

0 comments on commit d3c3a91

Please sign in to comment.