diff options
author | dave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-12-19 00:01:19 +0000 |
---|---|---|
committer | dave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-12-19 00:01:19 +0000 |
commit | d3b74e1806e572592b4242bee140813ffeefdaf1 (patch) | |
tree | 3f69040917e25ad5314c61c71dd9d767b03f3e17 /lib | |
parent | 84f0b051de55b80211eab0ad2438f500af45e4a5 (diff) |
Fix dependency issue
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rdoc/generators/ri_generator.rb | 8 | ||||
-rw-r--r-- | lib/rdoc/ri/ri_descriptions.rb | 82 |
2 files changed, 72 insertions, 18 deletions
diff --git a/lib/rdoc/generators/ri_generator.rb b/lib/rdoc/generators/ri_generator.rb index c2b5269c3c..4e842d09e9 100644 --- a/lib/rdoc/generators/ri_generator.rb +++ b/lib/rdoc/generators/ri_generator.rb @@ -236,7 +236,13 @@ module Generators namespace = rdr.top_level_namespace namespace = rdr.lookup_namespace_in(cls_desc.name, namespace) if namespace.empty? - raise RiError.new("Nothing known about #{arg}") + $stderr.puts "You asked me to merge this source into existing " + $stderr.puts "documentation. This file references a class or " + $stderr.puts "module called #{cls_desc.name} which I don't" + $stderr.puts "have existing documentation for." + $stderr.puts + $stderr.puts "Perhaps you need to generate its documentation first" + exit 1 else old_cls = namespace[0] end diff --git a/lib/rdoc/ri/ri_descriptions.rb b/lib/rdoc/ri/ri_descriptions.rb index 47984cf41d..9e280abf94 100644 --- a/lib/rdoc/ri/ri_descriptions.rb +++ b/lib/rdoc/ri/ri_descriptions.rb @@ -5,29 +5,64 @@ require 'yaml' # tree. ri then reads these to generate the documentation module RI - Alias = Struct.new(:old_name, :new_name) - AliasName = Struct.new(:name) - Attribute = Struct.new(:name, :rw, :comment) - Constant = Struct.new(:name, :value, :comment) - IncludedModule = Struct.new(:name) - - class MethodSummary - attr_accessor :name - def initialize(name="") + class NamedThing + attr_reader :name + def initialize(name) @name = name end - def <=>(other) - self.name <=> other.name + @name <=> other.name + end + + def hash + @name.hash + end + + def eql?(other) + @name.eql?(other) end end +# Alias = Struct.new(:old_name, :new_name) + + class AliasName < NamedThing + end + + class Attribute < NamedThing + attr_reader :rw, :comment + def initialize(name, rw, comment) + super(name) + @rw = rw + @comment = comment + end + end + + class Constant < NamedThing + attr_reader :value, :comment + def initialize(name, value, comment) + super(name) + @value = value + @comment = comment + end + end + + class IncludedModule < NamedThing + end + + + class MethodSummary < NamedThing + def initialize(name="") + super + end + end + + class Description attr_accessor :name attr_accessor :full_name attr_accessor :comment - + def serialize self.to_yaml end @@ -35,6 +70,10 @@ module RI def Description.deserialize(from) YAML.load(from) end + + def <=>(other) + @name <=> other.name + end end class ClassDescription < Description @@ -48,11 +87,20 @@ module RI # merge in another class desscription into this one def merge_in(old) - @class_methods.concat(old.class_methods).sort! - @instance_methods.concat(old.instance_methods).sort! - @attributes.concat(old.attributes).sort! - @constants.concat(old.constants).sort! - @includes.concat(old.includes).sort! + merge(@class_methods, old.class_methods) + merge(@instance_methods, old.instance_methods) + merge(@attributes, old.attributes) + merge(@constants, old.constants) + merge(@includes, old.includes) + end + + private + + def merge(into, from) + names = {} + into.each {|i| names[i.name] = i } + from.each {|i| names[i.name] = i } + into.replace(names.keys.sort.map {|n| names[n]}) end end |