提交 9e43ce5a 编写于 作者: G Guillermo Iguaran

Merge pull request #9573 from robertomiranda/useless_gsub

Use gsub intead of tr when the to_str is longer than the from_str
......@@ -28,7 +28,7 @@ module DebugHelper
# </pre>
def debug(object)
Marshal::dump(object)
object = ERB::Util.html_escape(object.to_yaml).tr(" ", "&nbsp; ").html_safe
object = ERB::Util.html_escape(object.to_yaml).gsub(" ", "&nbsp; ").html_safe
content_tag(:pre, object, :class => "debug_dump")
rescue Exception # errors from Marshal or YAML
# Object couldn't be dumped, perhaps because of singleton methods -- this is the fallback
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册