From cfc91c31aa989826e992be29b6d5b181f654f853 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Fri, 22 Jul 2016 23:13:42 +0200 Subject: systematic revision of =~ usage in AS Where appropriate prefer the more concise Regexp#match?, String#include?, String#start_with?, and String#end_with? --- activesupport/lib/active_support/multibyte/chars.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'activesupport/lib/active_support/multibyte') diff --git a/activesupport/lib/active_support/multibyte/chars.rb b/activesupport/lib/active_support/multibyte/chars.rb index 707cf200b5..83db68a66f 100644 --- a/activesupport/lib/active_support/multibyte/chars.rb +++ b/activesupport/lib/active_support/multibyte/chars.rb @@ -2,6 +2,7 @@ require 'active_support/json' require 'active_support/core_ext/string/access' require 'active_support/core_ext/string/behavior' require 'active_support/core_ext/module/delegation' +require 'active_support/core_ext/regexp' module ActiveSupport #:nodoc: module Multibyte #:nodoc: @@ -56,7 +57,7 @@ module ActiveSupport #:nodoc: # Forward all undefined methods to the wrapped string. def method_missing(method, *args, &block) result = @wrapped_string.__send__(method, *args, &block) - if method.to_s =~ /!$/ + if /!$/.match?(method) self if result else result.kind_of?(String) ? chars(result) : result -- cgit v1.2.3