Loading lib/jsduck/aggregator.rb +3 −1 Original line number Diff line number Diff line Loading @@ -156,7 +156,9 @@ module JsDuck # Creates classes for orphans that have :owner property defined, # and then inserts orphans to these classes. def classify_orphans @orphans.each do |orph| # Clone the orphans array first to avoid problems with # #inster_orphan method deleting items from @orphans array. @orphans.clone.each do |orph| if orph[:owner] class_name = orph[:owner] if !@classes[class_name] Loading spec/aggregator_members_spec.rb +23 −0 Original line number Diff line number Diff line Loading @@ -52,4 +52,27 @@ describe JsDuck::Aggregator do end end def parse_to_classes(string) agr = JsDuck::Aggregator.new agr.aggregate(JsDuck::Source::File.new(string)) agr.classify_orphans agr.result end it "creates classes for all orphans with @member defined" do classes = parse_to_classes(<<-EOS) /** * @cfg foo * @member FooCls */ /** * @cfg bar * @member BarCls */ EOS classes[0][:name].should == "FooCls" classes[1][:name].should == "BarCls" end end Loading
lib/jsduck/aggregator.rb +3 −1 Original line number Diff line number Diff line Loading @@ -156,7 +156,9 @@ module JsDuck # Creates classes for orphans that have :owner property defined, # and then inserts orphans to these classes. def classify_orphans @orphans.each do |orph| # Clone the orphans array first to avoid problems with # #inster_orphan method deleting items from @orphans array. @orphans.clone.each do |orph| if orph[:owner] class_name = orph[:owner] if !@classes[class_name] Loading
spec/aggregator_members_spec.rb +23 −0 Original line number Diff line number Diff line Loading @@ -52,4 +52,27 @@ describe JsDuck::Aggregator do end end def parse_to_classes(string) agr = JsDuck::Aggregator.new agr.aggregate(JsDuck::Source::File.new(string)) agr.classify_orphans agr.result end it "creates classes for all orphans with @member defined" do classes = parse_to_classes(<<-EOS) /** * @cfg foo * @member FooCls */ /** * @cfg bar * @member BarCls */ EOS classes[0][:name].should == "FooCls" classes[1][:name].should == "BarCls" end end