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

Merge pull request #9564 from robertomiranda/useless_gsub

change useless gsub to tr
This commit is contained in:
Guillermo Iguaran 2013-03-05 06:45:09 -08:00
commit 588f267e71
4 changed files with 5 additions and 5 deletions

View file

@ -11,7 +11,7 @@ module AbstractController
def translate(*args)
key = args.first
if key.is_a?(String) && (key[0] == '.')
key = "#{ controller_path.gsub('/', '.') }.#{ action_name }#{ key }"
key = "#{ controller_path.tr('/', '.') }.#{ action_name }#{ key }"
args[0] = key
end

View file

@ -10,7 +10,7 @@
clean_params.delete("action")
clean_params.delete("controller")
request_dump = clean_params.empty? ? 'None' : clean_params.inspect.gsub(',', ",\n")
request_dump = clean_params.empty? ? 'None' : clean_params.inspect.tr(',', ",\n")
def debug_hash(object)
object.to_hash.sort_by { |k, v| k.to_s }.map { |k, v| "#{k}: #{v.inspect rescue $!.message}" }.join("\n")
@ -31,4 +31,4 @@
</div>
<h2 style="margin-top: 30px">Response</h2>
<p><b>Headers</b>:</p> <pre><%= defined?(@response) ? @response.headers.inspect.gsub(',', ",\n") : 'None' %></pre>
<p><b>Headers</b>:</p> <pre><%= defined?(@response) ? @response.headers.inspect.tr(',', ",\n") : 'None' %></pre>

View file

@ -8,7 +8,7 @@
<h2>Failure reasons:</h2>
<ol>
<% @exception.failures.each do |route, reason| %>
<li><code><%= route.inspect.gsub('\\', '') %></code> failed because <%= reason.downcase %></li>
<li><code><%= route.inspect.delete('\\') %></code> failed because <%= reason.downcase %></li>
<% end %>
</ol>
</p>

View file

@ -28,7 +28,7 @@ module ActionView
# </pre>
def debug(object)
Marshal::dump(object)
object = ERB::Util.html_escape(object.to_yaml).gsub(" ", "&nbsp; ").html_safe
object = ERB::Util.html_escape(object.to_yaml).tr(" ", "&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