aboutsummaryrefslogtreecommitdiffstats
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
commitedeeefb7a544aadf2f788c8c6f88cb77bd941ac0 (patch)
treea00a32802cbdeded4f0fdf73a6214a7fbf295db1
parent3e39ade457b432a57d63e00d5a9898ca202d26f1 (diff)
downloadruby-edeeefb7a544aadf2f788c8c6f88cb77bd941ac0.tar.gz
Speed up Marshal load, fix bug with nested classes' methods
git-svn-id: svn+ssh://ci.ruby-lang.org/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 ff29296ec0..79be39f964 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 9b1e3bea30..98e8a3dc2e 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