summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-08 10:49:19 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-08 10:49:19 +0000
commit2c467e6217916f31513f05a48526f834c1fdc5ee (patch)
treea00a32802cbdeded4f0fdf73a6214a7fbf295db1
parent1da5b222e289cae8494666b867a340c94763ab26 (diff)
downloadruby-2c467e6217916f31513f05a48526f834c1fdc5ee.tar.gz
ruby-2c467e6217916f31513f05a48526f834c1fdc5ee.tar.xz
ruby-2c467e6217916f31513f05a48526f834c1fdc5ee.zip
Speed up Marshal load, fix bug with nested classes' methods
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--lib/rdoc/ri/driver.rb11
2 files changed, 13 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index ff29296ec..79be39f96 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Jan 8 19:48:15 2008 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/ri/driver.rb: Speed up Marshal.load. Fix bug with nested
+ classes' methods.
+
Tue Jan 8 19:17:29 2008 Eric Hodel <drbrain@segment7.net>
* lib/rdoc/*: Clean up namespacing of RI's classes.
diff --git a/lib/rdoc/ri/driver.rb b/lib/rdoc/ri/driver.rb
index 9b1e3bea3..98e8a3dc2 100644
--- a/lib/rdoc/ri/driver.rb
+++ b/lib/rdoc/ri/driver.rb
@@ -267,13 +267,13 @@ Options may also be set in the 'RI' environment variable.
if File.exist? path and
File.mtime(path) >= File.mtime(class_cache_file_path) then
File.open path, 'rb' do |fp|
- Marshal.load fp
+ Marshal.load fp.read
end
else
class_cache = nil
File.open class_cache_file_path, 'rb' do |fp|
- class_cache = Marshal.load fp
+ class_cache = Marshal.load fp.read
end
klass = class_cache[klassname]
@@ -354,7 +354,12 @@ Options may also be set in the 'RI' environment variable.
if class_cache.key? name then
display_class name
else
- klass, meth = name.split(/::|\#|\./)
+ meth = nil
+
+ parts = name.split(/::|\#|\./)
+ meth = parts.pop unless parts.last =~ /^[A-Z]/
+ klass = parts.join '::'
+
cache = load_cache_for klass
# HACK Does not support F.n
abort "Nothing known about #{name}" unless cache