diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-30 04:01:07 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-30 04:01:07 +0000 |
commit | 3c4633a3a1ace272566618c9e002489d3c03b569 (patch) | |
tree | a479525122ae1534b60b25992d5c373d47bdfd71 /lib/abbrev.rb | |
parent | 4078d42b72339cd80a88a1d2aa163b5499e2f5f7 (diff) | |
download | ruby-3c4633a3a1ace272566618c9e002489d3c03b569.tar.gz |
Stop using a regexp that causes a false warning.
* lib/abbrev.rb (Abbrev#abbrev): Stop using a regexp that causes a
false warning. [Bug #7471]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/abbrev.rb')
-rwxr-xr-x[-rw-r--r--] | lib/abbrev.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/abbrev.rb b/lib/abbrev.rb index 443ab6d8f1..d4f8196f49 100644..100755 --- a/lib/abbrev.rb +++ b/lib/abbrev.rb @@ -73,9 +73,9 @@ module Abbrev end words.each do |word| - next if (abbrev = word).empty? - while (len = abbrev.rindex(/[\w\W]\z/)) > 0 - abbrev = word[0,len] + next if word.empty? + word.size.downto(1) { |len| + abbrev = word[0...len] next if pattern && pattern !~ abbrev @@ -87,7 +87,7 @@ module Abbrev else break end - end + } end words.each do |word| |