From 01b0ccce32ffa9ed190072417a5da3e1f15322ed Mon Sep 17 00:00:00 2001 From: pavel Date: Wed, 12 Dec 2018 22:29:29 +0100 Subject: [PATCH] use match? --- actionview/lib/action_view/template/resolver.rb | 2 +- activemodel/lib/active_model/validations/numericality.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/actionview/lib/action_view/template/resolver.rb b/actionview/lib/action_view/template/resolver.rb index 08dd6fb510..12ae82f8c5 100644 --- a/actionview/lib/action_view/template/resolver.rb +++ b/actionview/lib/action_view/template/resolver.rb @@ -378,7 +378,7 @@ module ActionView # This regex match does double duty of finding only files which match # details (instead of just matching the prefix) and also filtering for # case-insensitive file systems. - !filename.match(regex) || + !regex.match?(filename) || File.directory?(filename) end.sort_by do |filename| # Because we scanned the directory, instead of checking for files diff --git a/activemodel/lib/active_model/validations/numericality.rb b/activemodel/lib/active_model/validations/numericality.rb index 1cafb15ac7..7be20527e9 100644 --- a/activemodel/lib/active_model/validations/numericality.rb +++ b/activemodel/lib/active_model/validations/numericality.rb @@ -98,15 +98,15 @@ module ActiveModel end def is_integer?(raw_value) - INTEGER_REGEX === raw_value.to_s + INTEGER_REGEX.match? raw_value.to_s end def is_decimal?(raw_value) - DECIMAL_REGEX === raw_value.to_s + DECIMAL_REGEX.match? raw_value.to_s end def is_hexadecimal_literal?(raw_value) - /\A0[xX]/ === raw_value + /\A0[xX]/.match? raw_value end def filtered_options(value)