aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/helpers/url_helper.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2016-07-25 00:31:35 +0200
committerXavier Noria <fxn@hashref.com>2016-07-25 00:31:35 +0200
commit7ebef567ce30d848dd8f9374fd70699fd91acb29 (patch)
tree9452737beec405626f309348b6d3c7fe4838ed91 /actionview/lib/action_view/helpers/url_helper.rb
parent11b463d8cbacfe2cc1662f9e314440de71806ca9 (diff)
downloadrails-7ebef567ce30d848dd8f9374fd70699fd91acb29.tar.gz
rails-7ebef567ce30d848dd8f9374fd70699fd91acb29.tar.bz2
rails-7ebef567ce30d848dd8f9374fd70699fd91acb29.zip
systematic revision of =~ usage in AV
Where appropriate, prefer the more concise Regexp#match?, String#include?, String#start_with?, or String#end_with?
Diffstat (limited to 'actionview/lib/action_view/helpers/url_helper.rb')
-rw-r--r--actionview/lib/action_view/helpers/url_helper.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/actionview/lib/action_view/helpers/url_helper.rb b/actionview/lib/action_view/helpers/url_helper.rb
index fb6426b997..5d7940a7b1 100644
--- a/actionview/lib/action_view/helpers/url_helper.rb
+++ b/actionview/lib/action_view/helpers/url_helper.rb
@@ -2,6 +2,7 @@ require 'action_view/helpers/javascript_helper'
require 'active_support/core_ext/array/access'
require 'active_support/core_ext/hash/keys'
require 'active_support/core_ext/string/output_safety'
+require 'active_support/core_ext/regexp'
module ActionView
# = Action View URL Helpers
@@ -550,7 +551,7 @@ module ActionView
url_string.chomp!("/") if url_string.start_with?("/") && url_string != "/"
- if url_string =~ /^\w+:\/\//
+ if %r{^\w+://}.match?(url_string)
url_string == "#{request.protocol}#{request.host_with_port}#{request_uri}"
else
url_string == request_uri