[#9722] Kernel#system broken inside Dir.chdir(&block) if system command doesn't have shell characters — <noreply@...>

Bugs item #7278, was opened at 2006-12-14 13:59

8 messages 2006/12/14

[#9749] System V IPC in standard library? — Steven Jenkins <steven.jenkins@...>

Back in August, I needed a semaphore to serialize access to an external

14 messages 2006/12/19

[#9753] CVS freeze — SASADA Koichi <ko1@...>

Hi,

20 messages 2006/12/20
[#9755] Re: [ruby-dev:30039] CVS freeze — SASADA Koichi <ko1@...> 2006/12/20

Hi,

[#9757] Re: [ruby-dev:30040] Re: CVS freeze — SASADA Koichi <ko1@...> 2006/12/20

Hi,

ri cannot display documents about the attributes of classes

From: "U.Nakamura" <usa@...>
Date: 2006-12-08 07:55:19 UTC
List: ruby-core #9680
Hello,

I found that ri cannot display documents about the attributes
of classes.
It's because the documents are written in cdesc-*.yaml files
and ri never reads them except when displaying class information.

I write a patch to solve this problem, but it's too slow.
Does anyone have another idea?

Index: lib/rdoc/ri/ri_cache.rb
===================================================================
RCS file: /home/cvs/ruby/lib/rdoc/ri/ri_cache.rb,v
retrieving revision 1.8
diff -u -1 -p -r1.8 ri_cache.rb
--- lib/rdoc/ri/ri_cache.rb	30 Aug 2004 14:20:57 -0000	1.8
+++ lib/rdoc/ri/ri_cache.rb	7 Dec 2006 08:29:39 -0000
@@ -14,2 +14,3 @@ module RI
       @inferior_classes = []
+      @attributes       = []
     end
@@ -36,3 +37,3 @@ module RI
 
-        if name =~ /^(.*?)-(c|i).yaml$/
+        if /^(.*?)-(c|i)\.yaml$/ =~ name
           external_name = $1
@@ -43,2 +44,4 @@ module RI
           list << MethodEntry.new(path, internal_name, is_class_method, self)
+        elsif /^cdesc-.*?\.yaml$/ =~ name
+          @attributes.concat(YAML.load_file(File.join(dir, name)).attributes.map{|a| a.full_name = full_name + "\##{a.name}"; a})
         else
@@ -116,5 +119,5 @@ module RI
       list = case is_class_method
-             when nil then  @class_methods + @instance_methods
+             when nil then  @class_methods + @instance_methods + @attributes
              when true then @class_methods
-             when false then @instance_methods
+             when false then @instance_methods + @attributes
              else fail "Unknown is_class_method: #{is_class_method.inspect}"
Index: lib/rdoc/ri/ri_descriptions.rb
===================================================================
RCS file: /home/cvs/ruby/lib/rdoc/ri/ri_descriptions.rb,v
retrieving revision 1.8
diff -u -1 -p -r1.8 ri_descriptions.rb
--- lib/rdoc/ri/ri_descriptions.rb	14 Jun 2006 22:24:36 -0000	1.8
+++ lib/rdoc/ri/ri_descriptions.rb	7 Dec 2006 08:29:39 -0000
@@ -33,2 +33,3 @@ module RI
     attr_reader :rw, :comment
+    attr_accessor :full_name
     def initialize(name, rw, comment)
Index: lib/rdoc/ri/ri_display.rb
===================================================================
RCS file: /home/cvs/ruby/lib/rdoc/ri/ri_display.rb,v
retrieving revision 1.6
diff -u -1 -p -r1.6 ri_display.rb
--- lib/rdoc/ri/ri_display.rb	24 Mar 2004 19:17:13 -0000	1.6
+++ lib/rdoc/ri/ri_display.rb	7 Dec 2006 08:29:39 -0000
@@ -63,3 +63,3 @@ class  DefaultDisplay
       display_flow(method.comment)
-      if method.aliases && !method.aliases.empty?
+      if method.respond_to?(:aliases) && method.aliases && !method.aliases.empty?
         @formatter.blankline
@@ -135,3 +135,3 @@ class  DefaultDisplay
         @formatter.blankline
-        @formatter.wrap("Attributes:", "")
+        @formatter.display_heading("Attributes:", 2, "")
         @formatter.wrap(klass.attributes.map{|a| a.name}.sort.join(', '))
@@ -224,10 +224,14 @@ class  DefaultDisplay
 
-    params = method.params
+    if method.respond_to?(:params)
+      params = method.params
 
-    if params[0,1] == "("
-      if method.is_singleton
-        params = method.full_name + params
-      else
-        params = method.name + params
+      if params[0,1] == "("
+        if method.is_singleton
+          params = method.full_name + params
+        else
+          params = method.name + params
+        end
       end
+    elsif method.respond_to?(:rw)
+      params = "[#{method.rw}] #{method.name}"
     end
Index: lib/rdoc/ri/ri_reader.rb
===================================================================
RCS file: /home/cvs/ruby/lib/rdoc/ri/ri_reader.rb,v
retrieving revision 1.7
diff -u -1 -p -r1.7 ri_reader.rb
--- lib/rdoc/ri/ri_reader.rb	30 Aug 2004 14:20:57 -0000	1.7
+++ lib/rdoc/ri/ri_reader.rb	7 Dec 2006 08:29:39 -0000
@@ -44,4 +44,8 @@ module RI
     def get_method(method_entry)
-      path = method_entry.path_name
-      File.open(path) { |f| RI::Description.deserialize(f) }
+      if method_entry.respond_to?(:path_name)
+        path = method_entry.path_name
+        File.open(path) { |f| RI::Description.deserialize(f) }
+      else
+        method_entry
+      end
     end

Regards,
-- 
U.Nakamura <usa@garbagecollect.jp>



In This Thread

Prev Next