diff --git a/.rubocop.yml b/.rubocop.yml index b231624..1c0f832 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -8,6 +8,7 @@ Performance: Enabled: true AllCops: + TargetRubyVersion: 2.4 Exclude: - 'vendor/bundle/**/*' diff --git a/lib/liquid/file_system.rb b/lib/liquid/file_system.rb index b2093ae..27ab632 100644 --- a/lib/liquid/file_system.rb +++ b/lib/liquid/file_system.rb @@ -59,7 +59,7 @@ module Liquid end def full_path(template_path) - raise FileSystemError, "Illegal template name '#{template_path}'" unless template_path =~ %r{\A[^./][a-zA-Z0-9_/]+\z} + raise FileSystemError, "Illegal template name '#{template_path}'" unless %r{\A[^./][a-zA-Z0-9_/]+\z}.match?(template_path) full_path = if template_path.include?('/') File.join(root, File.dirname(template_path), @pattern % File.basename(template_path)) diff --git a/lib/liquid/tags/raw.rb b/lib/liquid/tags/raw.rb index 093a37e..fde3ee1 100644 --- a/lib/liquid/tags/raw.rb +++ b/lib/liquid/tags/raw.rb @@ -40,7 +40,7 @@ module Liquid protected def ensure_valid_markup(tag_name, markup, parse_context) - unless markup =~ Syntax + unless Syntax.match?(markup) raise SyntaxError, parse_context.locale.t("errors.syntax.tag_unexpected_args", tag: tag_name) end end diff --git a/lib/liquid/utils.rb b/lib/liquid/utils.rb index 406d667..709fb00 100644 --- a/lib/liquid/utils.rb +++ b/lib/liquid/utils.rb @@ -52,7 +52,7 @@ module Liquid when Numeric obj when String - obj.strip =~ /\A-?\d+\.\d+\z/ ? BigDecimal(obj) : obj.to_i + /\A-?\d+\.\d+\z/.match?(obj.strip) ? BigDecimal(obj) : obj.to_i else if obj.respond_to?(:to_number) obj.to_number