1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

use tap with block parameter

This commit is contained in:
Akira Matsuda 2013-01-18 17:04:13 +09:00
parent f71467ac60
commit 02902e00ab

View file

@ -46,7 +46,7 @@ module Rails
alias inspect to_s alias inspect to_s
def to_html def to_html
(table = '<table>').tap do '<table>'.tap do |table|
properties.each do |(name, value)| properties.each do |(name, value)|
table << %(<tr><td class="name">#{CGI.escapeHTML(name.to_s)}</td>) table << %(<tr><td class="name">#{CGI.escapeHTML(name.to_s)}</td>)
formatted_value = if value.kind_of?(Array) formatted_value = if value.kind_of?(Array)