lib/sinatra/flash/style_patch.rb in gh-preview-1.0.0 vs lib/sinatra/flash/style_patch.rb in gh-preview-1.0.1
- old
+ new
@@ -18,10 +18,10 @@
# If you use this, the collection key will be appended to the top-level div id (e.g.,
# 'flash_login' if you pass a key of :login).
#
# @return [String] Styled HTML if the flash contains messages, or an empty string if it's empty.
#
- def styled_flash(key=:flash)
+ def styled_flash(key = :flash)
return '' if flash(key).empty?
id = (key == :flash ? 'flash' : "flash_#{key}")
messages = flash(key).collect { |message| " <div class='alert alert-#{message[0]}'>#{message[1]}</div>\n" }
"<div id='#{id}'>\n" + messages.join + '</div>'
end