1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
drbrain 2008-01-08 10:49:19 +00:00
parent 3e39ade457
commit edeeefb7a5
2 changed files with 13 additions and 3 deletions

View file

@ -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.

View file

@ -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