aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorAman Gupta <aman@tmm1.net>2013-03-04 20:07:39 -0800
committerAman Gupta <aman@tmm1.net>2013-03-04 20:09:21 -0800
commitcc986db54665c4155f1b8da5d3f2ebf4a55ef23f (patch)
treea6a93d0246c5abf34422c6ef6aa534913d53134f /activesupport/lib
parent5807513048b16a278bd10f26cb0fc5b3a0bacbec (diff)
downloadrails-cc986db54665c4155f1b8da5d3f2ebf4a55ef23f.tar.gz
rails-cc986db54665c4155f1b8da5d3f2ebf4a55ef23f.tar.bz2
rails-cc986db54665c4155f1b8da5d3f2ebf4a55ef23f.zip
Call String#gsub with Hash directly
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/core_ext/string/output_safety.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/string/output_safety.rb b/activesupport/lib/active_support/core_ext/string/output_safety.rb
index 5f85cedcf5..dc033ed11b 100644
--- a/activesupport/lib/active_support/core_ext/string/output_safety.rb
+++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb
@@ -42,7 +42,7 @@ class ERB
# html_escape_once('&lt;&lt; Accept & Checkout')
# # => "&lt;&lt; Accept &amp; Checkout"
def html_escape_once(s)
- result = s.to_s.gsub(HTML_ESCAPE_ONCE_REGEXP) { |special| HTML_ESCAPE[special] }
+ result = s.to_s.gsub(HTML_ESCAPE_ONCE_REGEXP, HTML_ESCAPE)
s.html_safe? ? result.html_safe : result
end
@@ -60,7 +60,7 @@ class ERB
# json_escape('{"name":"john","created_at":"2010-04-28T01:39:31Z","id":1}')
# # => {name:john,created_at:2010-04-28T01:39:31Z,id:1}
def json_escape(s)
- result = s.to_s.gsub(JSON_ESCAPE_REGEXP) { |special| JSON_ESCAPE[special] }
+ result = s.to_s.gsub(JSON_ESCAPE_REGEXP, JSON_ESCAPE)
s.html_safe? ? result.html_safe : result
end