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:
parent
3e39ade457
commit
edeeefb7a5
@ -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>
|
Tue Jan 8 19:17:29 2008 Eric Hodel <drbrain@segment7.net>
|
||||||
|
|
||||||
* lib/rdoc/*: Clean up namespacing of RI's classes.
|
* lib/rdoc/*: Clean up namespacing of RI's classes.
|
||||||
|
@ -267,13 +267,13 @@ Options may also be set in the 'RI' environment variable.
|
|||||||
if File.exist? path and
|
if File.exist? path and
|
||||||
File.mtime(path) >= File.mtime(class_cache_file_path) then
|
File.mtime(path) >= File.mtime(class_cache_file_path) then
|
||||||
File.open path, 'rb' do |fp|
|
File.open path, 'rb' do |fp|
|
||||||
Marshal.load fp
|
Marshal.load fp.read
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
class_cache = nil
|
class_cache = nil
|
||||||
|
|
||||||
File.open class_cache_file_path, 'rb' do |fp|
|
File.open class_cache_file_path, 'rb' do |fp|
|
||||||
class_cache = Marshal.load fp
|
class_cache = Marshal.load fp.read
|
||||||
end
|
end
|
||||||
|
|
||||||
klass = class_cache[klassname]
|
klass = class_cache[klassname]
|
||||||
@ -354,7 +354,12 @@ Options may also be set in the 'RI' environment variable.
|
|||||||
if class_cache.key? name then
|
if class_cache.key? name then
|
||||||
display_class name
|
display_class name
|
||||||
else
|
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
|
cache = load_cache_for klass
|
||||||
# HACK Does not support F.n
|
# HACK Does not support F.n
|
||||||
abort "Nothing known about #{name}" unless cache
|
abort "Nothing known about #{name}" unless cache
|
||||||
|
Loading…
x
Reference in New Issue
Block a user