summaryrefslogtreecommitdiff
path: root/lib/rdoc/ri/driver.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-09-05 10:35:30 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-09-05 10:35:30 +0000
commit23863ff75d3ec9205d5f365b98b6608e38a93749 (patch)
tree362b9fc870edb3820ef488a6618baf5669d3aa48 /lib/rdoc/ri/driver.rb
parent0d715e1b7540e1c876a4c53862355d5c43dd8683 (diff)
* lib/rdoc/*, test/rdoc/*: Update rdoc/rdoc master(f191513)
https://github.com/rdoc/rdoc/blob/master/History.rdoc#423--2016-- https://github.com/rdoc/rdoc/blob/master/History.rdoc#422--2016-02-09 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/ri/driver.rb')
-rw-r--r--lib/rdoc/ri/driver.rb19
1 files changed, 3 insertions, 16 deletions
diff --git a/lib/rdoc/ri/driver.rb b/lib/rdoc/ri/driver.rb
index 43c84ffa90..3bd0e50d84 100644
--- a/lib/rdoc/ri/driver.rb
+++ b/lib/rdoc/ri/driver.rb
@@ -907,22 +907,9 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
# will be expanded to Zlib::DataError.
def expand_class klass
- klass.split('::').inject '' do |expanded, klass_part|
- expanded << '::' unless expanded.empty?
- short = expanded << klass_part
-
- subset = classes.keys.select do |klass_name|
- klass_name =~ /^#{expanded}[^:]*$/
- end
-
- abbrevs = Abbrev.abbrev subset
-
- expanded = abbrevs[short]
-
- raise NotFoundError, short unless expanded
-
- expanded.dup
- end
+ ary = classes.keys.grep(Regexp.new("\\A#{klass.gsub(/(?=::|\z)/, '[^:]*')}\\z"))
+ raise NotFoundError, klass if ary.length != 1
+ ary.first
end
##