From 3bf961d7fd01c79cd6748e7f6531e341e47a6ef1 Mon Sep 17 00:00:00 2001 From: robertomiranda Date: Tue, 5 Mar 2013 09:26:31 -0500 Subject: change useless gsub to tr --- actionpack/lib/abstract_controller/translation.rb | 2 +- .../middleware/templates/rescues/_request_and_response.erb | 4 ++-- .../action_dispatch/middleware/templates/rescues/routing_error.erb | 2 +- actionpack/lib/action_view/helpers/debug_helper.rb | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/abstract_controller/translation.rb b/actionpack/lib/abstract_controller/translation.rb index db48022b9f..02028d8e05 100644 --- a/actionpack/lib/abstract_controller/translation.rb +++ b/actionpack/lib/abstract_controller/translation.rb @@ -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 diff --git a/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb b/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb index 550f4dbd0d..6b1f233930 100644 --- a/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb +++ b/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb @@ -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 @@

Response

-

Headers:

<%= defined?(@response) ? @response.headers.inspect.gsub(',', ",\n") : 'None' %>
+

Headers:

<%= defined?(@response) ? @response.headers.inspect.tr(',', ",\n") : 'None' %>
diff --git a/actionpack/lib/action_dispatch/middleware/templates/rescues/routing_error.erb b/actionpack/lib/action_dispatch/middleware/templates/rescues/routing_error.erb index 61690d3e50..cd3daff065 100644 --- a/actionpack/lib/action_dispatch/middleware/templates/rescues/routing_error.erb +++ b/actionpack/lib/action_dispatch/middleware/templates/rescues/routing_error.erb @@ -8,7 +8,7 @@

Failure reasons:

    <% @exception.failures.each do |route, reason| %> -
  1. <%= route.inspect.gsub('\\', '') %> failed because <%= reason.downcase %>
  2. +
  3. <%= route.inspect.delete('\\') %> failed because <%= reason.downcase %>
  4. <% end %>

diff --git a/actionpack/lib/action_view/helpers/debug_helper.rb b/actionpack/lib/action_view/helpers/debug_helper.rb index c29c1b1eea..db7f9f3494 100644 --- a/actionpack/lib/action_view/helpers/debug_helper.rb +++ b/actionpack/lib/action_view/helpers/debug_helper.rb @@ -28,7 +28,7 @@ module ActionView # def debug(object) Marshal::dump(object) - object = ERB::Util.html_escape(object.to_yaml).gsub(" ", "  ").html_safe + object = ERB::Util.html_escape(object.to_yaml).tr(" ", "  ").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 -- cgit v1.2.3