From 4078d42b72339cd80a88a1d2aa163b5499e2f5f7 Mon Sep 17 00:00:00 2001 From: knu Date: Fri, 30 Nov 2012 03:56:28 +0000 Subject: Fix a line matching problem in Abbrev.abbrev(words, "prefix"). * lib/abbrev.rb (Abbrev#abbrev): A fixed string prefix pattern should only match the beginning of each word, not the beginning of every line in it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/abbrev.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/abbrev.rb') diff --git a/lib/abbrev.rb b/lib/abbrev.rb index 1aae0e1fcf..443ab6d8f1 100644 --- a/lib/abbrev.rb +++ b/lib/abbrev.rb @@ -69,7 +69,7 @@ module Abbrev seen = Hash.new(0) if pattern.is_a?(String) - pattern = /^#{Regexp.quote(pattern)}/ # regard as a prefix + pattern = /\A#{Regexp.quote(pattern)}/ # regard as a prefix end words.each do |word| -- cgit v1.2.3