aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2019-07-29 14:23:10 +0900
committerAkira Matsuda <ronnie@dio.jp>2019-07-29 14:23:10 +0900
commit0196551e6039ca864d1eee1e01819fcae12c1dc9 (patch)
tree899db0e49063164697a005bca64fc5b06c2a2cfc /activesupport
parent0d981a2b3d26958f19e0613db8e5f480a34dd8fc (diff)
downloadrails-0196551e6039ca864d1eee1e01819fcae12c1dc9.tar.gz
rails-0196551e6039ca864d1eee1e01819fcae12c1dc9.tar.bz2
rails-0196551e6039ca864d1eee1e01819fcae12c1dc9.zip
Use match? where we don't need MatchData
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/backtrace_cleaner.rb4
-rw-r--r--activesupport/lib/active_support/parameter_filter.rb2
-rw-r--r--activesupport/test/cache/stores/mem_cache_store_test.rb2
-rw-r--r--activesupport/test/cache/stores/redis_cache_store_test.rb2
-rw-r--r--activesupport/test/callbacks_test.rb2
-rw-r--r--activesupport/test/parameter_filter_test.rb4
6 files changed, 8 insertions, 8 deletions
diff --git a/activesupport/lib/active_support/backtrace_cleaner.rb b/activesupport/lib/active_support/backtrace_cleaner.rb
index f55e821e10..6273012808 100644
--- a/activesupport/lib/active_support/backtrace_cleaner.rb
+++ b/activesupport/lib/active_support/backtrace_cleaner.rb
@@ -16,7 +16,7 @@ module ActiveSupport
#
# bc = ActiveSupport::BacktraceCleaner.new
# bc.add_filter { |line| line.gsub(Rails.root.to_s, '') } # strip the Rails.root prefix
- # bc.add_silencer { |line| line =~ /puma|rubygems/ } # skip any lines from puma or rubygems
+ # bc.add_silencer { |line| /puma|rubygems/.match?(line) } # skip any lines from puma or rubygems
# bc.clean(exception.backtrace) # perform the cleanup
#
# To reconfigure an existing BacktraceCleaner (like the default one in Rails)
@@ -65,7 +65,7 @@ module ActiveSupport
# for a given line, it will be excluded from the clean backtrace.
#
# # Will reject all lines that include the word "puma", like "/gems/puma/server.rb" or "/app/my_puma_server/rb"
- # backtrace_cleaner.add_silencer { |line| line =~ /puma/ }
+ # backtrace_cleaner.add_silencer { |line| /puma/.match?(line) }
def add_silencer(&block)
@silencers << block
end
diff --git a/activesupport/lib/active_support/parameter_filter.rb b/activesupport/lib/active_support/parameter_filter.rb
index e1cd7c46c1..f4c4f2d2fb 100644
--- a/activesupport/lib/active_support/parameter_filter.rb
+++ b/activesupport/lib/active_support/parameter_filter.rb
@@ -22,7 +22,7 @@ module ActiveSupport
# change { file: { code: "xxxx"} }
#
# ActiveSupport::ParameterFilter.new([-> (k, v) do
- # v.reverse! if k =~ /secret/i
+ # v.reverse! if /secret/i.match?(k)
# end])
# => reverses the value to all keys matching /secret/i
class ParameterFilter
diff --git a/activesupport/test/cache/stores/mem_cache_store_test.rb b/activesupport/test/cache/stores/mem_cache_store_test.rb
index 3917d14d1c..0a5e20ed46 100644
--- a/activesupport/test/cache/stores/mem_cache_store_test.rb
+++ b/activesupport/test/cache/stores/mem_cache_store_test.rb
@@ -9,7 +9,7 @@ require "dalli"
# connection pool testing.
class SlowDalliClient < Dalli::Client
def get(key, options = {})
- if key =~ /latency/
+ if /latency/.match?(key)
sleep 3
else
super
diff --git a/activesupport/test/cache/stores/redis_cache_store_test.rb b/activesupport/test/cache/stores/redis_cache_store_test.rb
index a2177e0476..0ea37b15d5 100644
--- a/activesupport/test/cache/stores/redis_cache_store_test.rb
+++ b/activesupport/test/cache/stores/redis_cache_store_test.rb
@@ -15,7 +15,7 @@ Redis::Connection.drivers.append(driver)
# connection pool testing.
class SlowRedis < Redis
def get(key, options = {})
- if key =~ /latency/
+ if /latency/.match?(key)
sleep 3
else
super
diff --git a/activesupport/test/callbacks_test.rb b/activesupport/test/callbacks_test.rb
index cc37c4fa99..221a8a5731 100644
--- a/activesupport/test/callbacks_test.rb
+++ b/activesupport/test/callbacks_test.rb
@@ -256,7 +256,7 @@ module CallbacksTest
end
def respond_to_missing?(sym)
- sym =~ /^(log|wrap)_/ || super
+ sym.match?(/^(log|wrap)_/) || super
end
end
diff --git a/activesupport/test/parameter_filter_test.rb b/activesupport/test/parameter_filter_test.rb
index e680a22479..510921cf95 100644
--- a/activesupport/test/parameter_filter_test.rb
+++ b/activesupport/test/parameter_filter_test.rb
@@ -22,7 +22,7 @@ class ParameterFilterTest < ActiveSupport::TestCase
filter_words << "blah"
filter_words << lambda { |key, value|
- value.reverse! if key =~ /bargain/
+ value.reverse! if /bargain/.match?(key)
}
filter_words << lambda { |key, value, original_params|
value.replace("world!") if original_params["barg"]["blah"] == "bar" && key == "hello"
@@ -61,7 +61,7 @@ class ParameterFilterTest < ActiveSupport::TestCase
filter_words << "blah"
filter_words << lambda { |key, value|
- value.reverse! if key =~ /bargain/
+ value.reverse! if /bargain/.match?(key)
}
filter_words << lambda { |key, value, original_params|
value.replace("world!") if original_params["barg"]["blah"] == "bar" && key == "hello"