Skip to content

Commit

Permalink
Use Regexp#=== to match loosely
Browse files Browse the repository at this point in the history
Till ruby 2.5, `Object#=~` silently ignored non-string argument,
but it has been deprecated since ruby 2.6 and will be removed in
the future.  Use `Regexp#===` instead, to match loosely.

Also `/^-/` is not a proper pattern to tell if the argument starts
with a `-`.
  • Loading branch information
nobu committed Dec 7, 2018
1 parent 80e00e2 commit 3785620
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rake/application.rb
Expand Up @@ -392,7 +392,7 @@ def trace(*strings) # :nodoc:

def sort_options(options) # :nodoc:
options.sort_by { |opt|
opt.select { |o| o =~ /^-/ }.map(&:downcase).sort.reverse
opt.select { |o| /\A-/ === o }.map(&:downcase).sort.reverse
}
end
private :sort_options
Expand Down

0 comments on commit 3785620

Please sign in to comment.