lib/yard/code_objects/class_object.rb in yard-0.2.2 vs lib/yard/code_objects/class_object.rb in yard-0.2.3

- old
+ new

@@ -4,28 +4,29 @@ def initialize(namespace, name, *args, &block) super if is_exception? - self.superclass ||= :Exception + self.superclass ||= :Exception unless P(namespace, name) == P(:Exception) else self.superclass ||= :Object unless P(namespace, name) == P(:Object) end end def is_exception? inheritance_tree.reverse.any? {|o| BUILTIN_EXCEPTIONS_HASH.has_key? o.path } end def inheritance_tree(include_mods = false) - list = [self] + (include_mods ? mixins : []) - if superclass.is_a? Proxy + list = (include_mods ? mixins(:instance) : []) + if superclass.is_a?(Proxy) || superclass.respond_to?(:inheritance_tree) list << superclass unless superclass == P(:Object) - elsif superclass.respond_to? :inheritance_tree - list += superclass.inheritance_tree end - list + [self] + list.map do |m| + next m unless m.respond_to?(:inheritance_tree) + m.inheritance_tree(include_mods) + end.flatten end def meths(opts = {}) opts = SymbolHash[:inherited => true].update(opts) super(opts) + (opts[:inherited] ? inherited_meths(opts) : []) @@ -78,12 +79,12 @@ if name == @superclass.name && namespace != YARD::Registry.root @superclass = Proxy.new(namespace.namespace, object) end if @superclass == self - msg = "superclass #{@superclass.inspect} cannot be the same as the subclass #{self}" + msg = "superclass #{@superclass.inspect} cannot be the same as the declared class #{self.inspect}" @superclass = P(:Object) raise ArgumentError, msg end end end -end \ No newline at end of file +end