[#7708] Bug in libsnmp-ruby1.8 — Hadmut Danisch <hadmut@...>

Hi,

8 messages 2006/04/11
[#7709] Re: Bug in libsnmp-ruby1.8 — Eric Hodel <drbrain@...7.net> 2006/04/11

On Apr 11, 2006, at 6:23 AM, Hadmut Danisch wrote:

[#7770] Re: possible defect in array.c — "Brown, Warren" <warrenbrown@...>

> rb_range_beg_len (in range.c) does set beg and len.

13 messages 2006/04/26
[#7771] Re: possible defect in array.c — "Pat Eyler" <rubypate@...> 2006/04/26

On 4/26/06, Brown, Warren <warrenbrown@aquire.com> wrote:

Patch for ri to show subclasses at class documentation

From: Sven Klemm <sven@...3d2.de>
Date: 2006-04-25 01:43:18 UTC
List: ruby-core #7760
Hello,

I've written a patch for ri to also show subclasses at the class documentation.
The output with the patch looks like this:

~> ri -T Momomoto
-------------------------------------------------------- Class: Momomoto
     Momomoto is a database abstraction layer

------------------------------------------------------------------------


SubClasses:
-----------
     Base, CriticalError, Database, Datatype, Error, Function,
     Information_schema, Table, View

I've attached a patch to the ri classes and a standalone version.
I would really love to see this integrated into the official ri.

Sven

Attachments (3)

ri (3 KB, application/x-sh)
ri-patch.diff (1.64 KB, text/x-diff)
diff -wur rdoc-org/ri/ri_descriptions.rb rdoc/ri/ri_descriptions.rb
--- rdoc-org/ri/ri_descriptions.rb	2006-04-02 20:46:04.000000000 +0200
+++ rdoc/ri/ri_descriptions.rb	2006-04-02 20:47:21.000000000 +0200
@@ -63,6 +63,7 @@
     attr_accessor :name
     attr_accessor :full_name
     attr_accessor :comment
+    attr_accessor :subclasses
 
     def serialize
       self.to_yaml
diff -wur rdoc-org/ri/ri_display.rb rdoc/ri/ri_display.rb
--- rdoc-org/ri/ri_display.rb	2006-04-02 20:46:04.000000000 +0200
+++ rdoc/ri/ri_display.rb	2006-04-02 20:53:15.000000000 +0200
@@ -136,6 +136,12 @@
         @formatter.wrap("Attributes:", "")
         @formatter.wrap(klass.attributes.map{|a| a.name}.sort.join(', '))
       end
+
+      unless klass.subclasses.empty?
+        @formatter.blankline
+        @formatter.display_heading("SubClasses:", 2, "")
+        @formatter.wrap(klass.subclasses.sort.join(', '))
+      end
     end
   end
   
diff -wur rdoc-org/ri/ri_reader.rb rdoc/ri/ri_reader.rb
--- rdoc-org/ri/ri_reader.rb	2006-04-02 20:46:04.000000000 +0200
+++ rdoc/ri/ri_reader.rb	2006-04-02 20:51:33.000000000 +0200
@@ -51,7 +51,17 @@
       result = nil
       for path in class_entry.path_names
         path = RiWriter.class_desc_path(path, class_entry)
+        dir = Dir.open( File.dirname( path ) )
+        subclasses = []
+        dir.each do | d |
+          next if d.match(/^\./)
+          next unless File.directory?( File.join( dir.path, d ) )
+          subclasses.push( d )
+        end
+
         desc = File.open(path) {|f| RI::Description.deserialize(f) }
+        desc.subclasses = subclasses
+
         if result
           result.merge_in(desc)
         else
signature.asc (250 Bytes, application/pgp-signature)

In This Thread

Prev Next