[前][次][番号順一覧][スレッド一覧]

ruby-changes:3461

From: ko1@a...
Date: 8 Jan 2008 19:49:28 +0900
Subject: [ruby-changes:3461] drbrain - Ruby:r14954 (trunk): Speed up Marshal load, fix bug with nested classes' methods

drbrain	2008-01-08 19:49:19 +0900 (Tue, 08 Jan 2008)

  New Revision: 14954

  Modified files:
    trunk/ChangeLog
    trunk/lib/rdoc/ri/driver.rb

  Log:
    Speed up Marshal load, fix bug with nested classes' methods

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/rdoc/ri/driver.rb?r1=14954&r2=14953&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14954&r2=14953&diff_format=u

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 14953)
+++ ChangeLog	(revision 14954)
@@ -1,3 +1,8 @@
+Tue Jan  8 19:48:15 2008  Eric Hodel  <drbrain@s...>
+
+	* 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@s...>
 
 	* lib/rdoc/*: Clean up namespacing of RI's classes.
Index: lib/rdoc/ri/driver.rb
===================================================================
--- lib/rdoc/ri/driver.rb	(revision 14953)
+++ lib/rdoc/ri/driver.rb	(revision 14954)
@@ -267,13 +267,13 @@
     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 @@
           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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧]