mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
4078d42b72
commit
3c4633a3a1
2 changed files with 7 additions and 4 deletions
|
|
@ -4,6 +4,9 @@ Fri Nov 30 12:47:59 2012 Akinori MUSHA <knu@iDaemons.org>
|
|||
should only match the beginning of each word, not the beginning
|
||||
of every line in it.
|
||||
|
||||
* lib/abbrev.rb (Abbrev#abbrev): Stop using a regexp that causes a
|
||||
false warning. [Bug #7471]
|
||||
|
||||
Fri Nov 30 12:30:55 2012 Akinori MUSHA <knu@iDaemons.org>
|
||||
|
||||
* test/test_abbrev.rb: Add tests for lib/abbrev.rb.
|
||||
|
|
|
|||
8
lib/abbrev.rb
Normal file → Executable file
8
lib/abbrev.rb
Normal file → Executable file
|
|
@ -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|
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue