Loading lib/jsduck/class.rb +11 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,16 @@ module JsDuck @doc[:extends] ? lookup(@doc[:extends]) : nil end # Returns array of ancestor classes. # Example result when asking ancestors of MyPanel might be: # # [Ext.util.Observable, Ext.Component, Ext.Panel] # def superclasses p = parent p ? p.superclasses + [p] : [] end # Returns array of mixin class instances. # Returns empty array if no mixins def mixins Loading Loading @@ -49,6 +59,7 @@ module JsDuck doc.delete(:method) doc.delete(:event) doc[:component] = inherits_from?("Ext.Component") doc[:superclasses] = superclasses.collect {|cls| cls.full_name } doc end Loading lib/jsduck/inheritance_tree.rb +1 −11 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ module JsDuck # Renders the tree using HTML <pre> element def to_html i = -1 html = ancestors(@cls).reverse.collect do |cls| html = (@cls.superclasses + [@cls]).collect do |cls| i += 1 make_indent(i) + make_link(cls) end.join("\n") Loading @@ -21,16 +21,6 @@ module JsDuck EOHTML end # Returns array of the names of ancestor classes for given class. # Including the name of the class itself. # Example result when ascing ancestors of MyPanel might be: # # [MyPanel, Ext.Panel, Ext.Component, Ext.util.Observable] # def ancestors(cls) cls.parent ? [cls] + ancestors(cls.parent) : [cls] end def make_indent(level) if level > 0 (" " * level) + "<img src='resources/elbow-end.gif' alt=''>" Loading Loading
lib/jsduck/class.rb +11 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,16 @@ module JsDuck @doc[:extends] ? lookup(@doc[:extends]) : nil end # Returns array of ancestor classes. # Example result when asking ancestors of MyPanel might be: # # [Ext.util.Observable, Ext.Component, Ext.Panel] # def superclasses p = parent p ? p.superclasses + [p] : [] end # Returns array of mixin class instances. # Returns empty array if no mixins def mixins Loading Loading @@ -49,6 +59,7 @@ module JsDuck doc.delete(:method) doc.delete(:event) doc[:component] = inherits_from?("Ext.Component") doc[:superclasses] = superclasses.collect {|cls| cls.full_name } doc end Loading
lib/jsduck/inheritance_tree.rb +1 −11 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ module JsDuck # Renders the tree using HTML <pre> element def to_html i = -1 html = ancestors(@cls).reverse.collect do |cls| html = (@cls.superclasses + [@cls]).collect do |cls| i += 1 make_indent(i) + make_link(cls) end.join("\n") Loading @@ -21,16 +21,6 @@ module JsDuck EOHTML end # Returns array of the names of ancestor classes for given class. # Including the name of the class itself. # Example result when ascing ancestors of MyPanel might be: # # [MyPanel, Ext.Panel, Ext.Component, Ext.util.Observable] # def ancestors(cls) cls.parent ? [cls] + ancestors(cls.parent) : [cls] end def make_indent(level) if level > 0 (" " * level) + "<img src='resources/elbow-end.gif' alt=''>" Loading