Loading lib/jsduck/exporter/app.rb +17 −3 Original line number Diff line number Diff line Loading @@ -6,17 +6,31 @@ module JsDuck module Exporter # Exports data for Docs app. class App < Full class App def initialize(relations, opts) super(relations, opts) @full_exporter = Exporter::Full.new(relations, opts) @relations = relations @renderer = Render::Class.new(opts) end # Returns compacted class data hash which contains an additional # :html field with full HTML to show on class overview page. def export(cls) data = super(cls) data = @full_exporter.export(cls) data[:component] = cls.inherits_from?("Ext.Component") data[:superclasses] = cls.superclasses.collect {|c| c[:name] } data[:subclasses] = @relations.subclasses(cls).collect {|c| c[:name] }.sort data[:mixedInto] = @relations.mixed_into(cls).collect {|c| c[:name] }.sort data[:alternateClassNames] = cls[:alternateClassNames].sort if cls[:alternateClassNames] data[:mixins] = cls.deps(:mixins).collect {|c| c[:name] }.sort data[:parentMixins] = cls.parent_deps(:mixins).collect {|c| c[:name] }.sort data[:requires] = cls.deps(:requires).collect {|c| c[:name] }.sort data[:uses] = cls.deps(:uses).collect {|c| c[:name] }.sort data[:html] = @renderer.render(data) return compact(data) end Loading lib/jsduck/exporter/full.rb +4 −14 Original line number Diff line number Diff line Loading @@ -6,11 +6,12 @@ module JsDuck # Exporter for all the class docs. class Full def initialize(relations, opts={}) @relations = relations # opts parameter is here just for compatibility with other exporters # parameters are just for compatibility with other exporters end # Returns all data in Class object as hash. # Returns a hash of class data, with :members field expanded # into list of all members (including those inherited from # parents and mixins). def export(cls) # Make copy of the internal data structure of a class # so our modifications on it will be safe. Loading @@ -18,17 +19,6 @@ module JsDuck h[:members] = export_members(cls) h[:component] = cls.inherits_from?("Ext.Component") h[:superclasses] = cls.superclasses.collect {|c| c[:name] } h[:subclasses] = @relations.subclasses(cls).collect {|c| c[:name] }.sort h[:mixedInto] = @relations.mixed_into(cls).collect {|c| c[:name] }.sort h[:alternateClassNames] = cls[:alternateClassNames].sort if cls[:alternateClassNames] h[:mixins] = cls.deps(:mixins).collect {|c| c[:name] }.sort h[:parentMixins] = cls.parent_deps(:mixins).collect {|c| c[:name] }.sort h[:requires] = cls.deps(:requires).collect {|c| c[:name] }.sort h[:uses] = cls.deps(:uses).collect {|c| c[:name] }.sort h end Loading Loading
lib/jsduck/exporter/app.rb +17 −3 Original line number Diff line number Diff line Loading @@ -6,17 +6,31 @@ module JsDuck module Exporter # Exports data for Docs app. class App < Full class App def initialize(relations, opts) super(relations, opts) @full_exporter = Exporter::Full.new(relations, opts) @relations = relations @renderer = Render::Class.new(opts) end # Returns compacted class data hash which contains an additional # :html field with full HTML to show on class overview page. def export(cls) data = super(cls) data = @full_exporter.export(cls) data[:component] = cls.inherits_from?("Ext.Component") data[:superclasses] = cls.superclasses.collect {|c| c[:name] } data[:subclasses] = @relations.subclasses(cls).collect {|c| c[:name] }.sort data[:mixedInto] = @relations.mixed_into(cls).collect {|c| c[:name] }.sort data[:alternateClassNames] = cls[:alternateClassNames].sort if cls[:alternateClassNames] data[:mixins] = cls.deps(:mixins).collect {|c| c[:name] }.sort data[:parentMixins] = cls.parent_deps(:mixins).collect {|c| c[:name] }.sort data[:requires] = cls.deps(:requires).collect {|c| c[:name] }.sort data[:uses] = cls.deps(:uses).collect {|c| c[:name] }.sort data[:html] = @renderer.render(data) return compact(data) end Loading
lib/jsduck/exporter/full.rb +4 −14 Original line number Diff line number Diff line Loading @@ -6,11 +6,12 @@ module JsDuck # Exporter for all the class docs. class Full def initialize(relations, opts={}) @relations = relations # opts parameter is here just for compatibility with other exporters # parameters are just for compatibility with other exporters end # Returns all data in Class object as hash. # Returns a hash of class data, with :members field expanded # into list of all members (including those inherited from # parents and mixins). def export(cls) # Make copy of the internal data structure of a class # so our modifications on it will be safe. Loading @@ -18,17 +19,6 @@ module JsDuck h[:members] = export_members(cls) h[:component] = cls.inherits_from?("Ext.Component") h[:superclasses] = cls.superclasses.collect {|c| c[:name] } h[:subclasses] = @relations.subclasses(cls).collect {|c| c[:name] }.sort h[:mixedInto] = @relations.mixed_into(cls).collect {|c| c[:name] }.sort h[:alternateClassNames] = cls[:alternateClassNames].sort if cls[:alternateClassNames] h[:mixins] = cls.deps(:mixins).collect {|c| c[:name] }.sort h[:parentMixins] = cls.parent_deps(:mixins).collect {|c| c[:name] }.sort h[:requires] = cls.deps(:requires).collect {|c| c[:name] }.sort h[:uses] = cls.deps(:uses).collect {|c| c[:name] }.sort h end Loading