Class RDoc::Generator::Class
In: generator.rb
doc-tmp/rdoc/generator.rb
Parent: Context

Wrap a ClassModule context

Methods

Public Class methods

[Source]

     # File doc-tmp/rdoc/generator.rb, line 520
520:     def initialize(context, html_file, prefix, options)
521:       super(context, options)
522: 
523:       @html_file = html_file
524:       @is_module = context.is_module?
525:       @values    = {}
526: 
527:       context.viewer = self
528: 
529:       if options.all_one_file
530:         @path = context.full_name
531:       else
532:         @path = http_url(context.full_name, prefix)
533:       end
534: 
535:       collect_methods
536: 
537:       AllReferences.add(name, self)
538:     end

[Source]

     # File generator.rb, line 520
520:     def initialize(context, html_file, prefix, options)
521:       super(context, options)
522: 
523:       @html_file = html_file
524:       @is_module = context.is_module?
525:       @values    = {}
526: 
527:       context.viewer = self
528: 
529:       if options.all_one_file
530:         @path = context.full_name
531:       else
532:         @path = http_url(context.full_name, prefix)
533:       end
534: 
535:       collect_methods
536: 
537:       AllReferences.add(name, self)
538:     end

Public Instance methods

[Source]

     # File doc-tmp/rdoc/generator.rb, line 691
691:     def <=>(other)
692:       self.name <=> other.name
693:     end

[Source]

     # File generator.rb, line 691
691:     def <=>(other)
692:       self.name <=> other.name
693:     end

[Source]

     # File doc-tmp/rdoc/generator.rb, line 620
620:     def build_attribute_list(section)
621:       atts = @context.attributes.sort
622:       res = []
623:       atts.each do |att|
624:         next unless att.section == section
625:         if att.visibility == :public || att.visibility == :protected || @options.show_all
626:           entry = {
627:             "name"   => CGI.escapeHTML(att.name),
628:             "rw"     => att.rw,
629:             "a_desc" => markup(att.comment, true)
630:           }
631:           unless att.visibility == :public || att.visibility == :protected
632:             entry["rw"] << "-"
633:           end
634:           res << entry
635:         end
636:       end
637:       res
638:     end

[Source]

     # File generator.rb, line 620
620:     def build_attribute_list(section)
621:       atts = @context.attributes.sort
622:       res = []
623:       atts.each do |att|
624:         next unless att.section == section
625:         if att.visibility == :public || att.visibility == :protected || @options.show_all
626:           entry = {
627:             "name"   => CGI.escapeHTML(att.name),
628:             "rw"     => att.rw,
629:             "a_desc" => markup(att.comment, true)
630:           }
631:           unless att.visibility == :public || att.visibility == :protected
632:             entry["rw"] << "-"
633:           end
634:           res << entry
635:         end
636:       end
637:       res
638:     end

[Source]

     # File generator.rb, line 640
640:     def class_attribute_values
641:       h_name = CGI.escapeHTML(name)
642: 
643:       @values["path"]      = @path
644:       @values["classmod"]  = @is_module ? "Module" : "Class"
645:       @values["title"]     = "#{@values['classmod']}: #{h_name}"
646: 
647:       c = @context
648:       c = c.parent while c and !c.diagram
649:       if c && c.diagram
650:         @values["diagram"] = diagram_reference(c.diagram)
651:       end
652: 
653:       @values["full_name"] = h_name
654: 
655:       parent_class = @context.superclass
656: 
657:       if parent_class
658:         @values["parent"] = CGI.escapeHTML(parent_class)
659: 
660:         if parent_name
661:           lookup = parent_name + "::" + parent_class
662:         else
663:           lookup = parent_class
664:         end
665: 
666:         parent_url = AllReferences[lookup] || AllReferences[parent_class]
667: 
668:         if parent_url and parent_url.document_self
669:           @values["par_url"] = aref_to(parent_url.path)
670:         end
671:       end
672: 
673:       files = []
674:       @context.in_files.each do |f|
675:         res = {}
676:         full_path = CGI.escapeHTML(f.file_absolute_name)
677: 
678:         res["full_path"]     = full_path
679:         res["full_path_url"] = aref_to(f.viewer.path) if f.document_self
680: 
681:         if @options.webcvs
682:           res["cvsurl"] = cvs_url( @options.webcvs, full_path )
683:         end
684: 
685:         files << res
686:       end
687: 
688:       @values['infiles'] = files
689:     end

[Source]

     # File doc-tmp/rdoc/generator.rb, line 640
640:     def class_attribute_values
641:       h_name = CGI.escapeHTML(name)
642: 
643:       @values["path"]      = @path
644:       @values["classmod"]  = @is_module ? "Module" : "Class"
645:       @values["title"]     = "#{@values['classmod']}: #{h_name}"
646: 
647:       c = @context
648:       c = c.parent while c and !c.diagram
649:       if c && c.diagram
650:         @values["diagram"] = diagram_reference(c.diagram)
651:       end
652: 
653:       @values["full_name"] = h_name
654: 
655:       parent_class = @context.superclass
656: 
657:       if parent_class
658:         @values["parent"] = CGI.escapeHTML(parent_class)
659: 
660:         if parent_name
661:           lookup = parent_name + "::" + parent_class
662:         else
663:           lookup = parent_class
664:         end
665: 
666:         parent_url = AllReferences[lookup] || AllReferences[parent_class]
667: 
668:         if parent_url and parent_url.document_self
669:           @values["par_url"] = aref_to(parent_url.path)
670:         end
671:       end
672: 
673:       files = []
674:       @context.in_files.each do |f|
675:         res = {}
676:         full_path = CGI.escapeHTML(f.file_absolute_name)
677: 
678:         res["full_path"]     = full_path
679:         res["full_path_url"] = aref_to(f.viewer.path) if f.document_self
680: 
681:         if @options.webcvs
682:           res["cvsurl"] = cvs_url( @options.webcvs, full_path )
683:         end
684: 
685:         files << res
686:       end
687: 
688:       @values['infiles'] = files
689:     end

Returns the relative file name to store this class in, which is also its url

[Source]

     # File generator.rb, line 544
544:     def http_url(full_name, prefix)
545:       path = full_name.dup
546: 
547:       path.gsub!(/<<\s*(\w*)/, 'from-\1') if path['<<']
548:       suffix = ".html"
549:       suffix = ".xhtml" if @options.template == "xhtml"
550: 
551:       ::File.join(prefix, path.split("::")) + suffix
552:     end

Returns the relative file name to store this class in, which is also its url

[Source]

     # File doc-tmp/rdoc/generator.rb, line 544
544:     def http_url(full_name, prefix)
545:       path = full_name.dup
546: 
547:       path.gsub!(/<<\s*(\w*)/, 'from-\1') if path['<<']
548:       suffix = ".html"
549:       suffix = ".xhtml" if @options.template == "xhtml"
550: 
551:       ::File.join(prefix, path.split("::")) + suffix
552:     end

[Source]

     # File generator.rb, line 562
562:     def index_name
563:       name
564:     end

[Source]

     # File doc-tmp/rdoc/generator.rb, line 562
562:     def index_name
563:       name
564:     end

[Source]

     # File generator.rb, line 554
554:     def name
555:       @context.full_name
556:     end

[Source]

     # File doc-tmp/rdoc/generator.rb, line 554
554:     def name
555:       @context.full_name
556:     end

[Source]

     # File generator.rb, line 558
558:     def parent_name
559:       @context.parent.full_name
560:     end

[Source]

     # File doc-tmp/rdoc/generator.rb, line 558
558:     def parent_name
559:       @context.parent.full_name
560:     end

[Source]

     # File doc-tmp/rdoc/generator.rb, line 574
574:     def value_hash
575:       class_attribute_values
576:       add_table_of_sections
577: 
578:       @values["charset"] = @options.charset
579:       @values["style_url"] = style_url(path, @options.css)
580:       @values["mathml_xsl_url"] = style_url(path, "mathml.xsl")
581: 
582:       d = markup(@context.comment)
583:       @values["description"] = d unless d.empty?
584: 
585:       ml = build_method_summary_list
586:       @values["methods"] = ml unless ml.empty?
587: 
588:       il = build_include_list(@context)
589:       @values["includes"] = il unless il.empty?
590: 
591:       @values["sections"] = @context.sections.map do |section|
592: 
593:         secdata = {
594:           "sectitle" => section.title,
595:           "secsequence" => section.sequence,
596:           "seccomment" => markup(section.comment)
597:         }
598: 
599:         al = build_alias_summary_list(section)
600:         secdata["aliases"] = al unless al.empty?
601: 
602:         co = build_constants_summary_list(section)
603:         secdata["constants"] = co unless co.empty?
604: 
605:         al = build_attribute_list(section)
606:         secdata["attributes"] = al unless al.empty?
607: 
608:         cl = build_class_list(0, @context, section)
609:         secdata["classlist"] = cl unless cl.empty?
610: 
611:         mdl = build_method_detail_list(section)
612:         secdata["method_list"] = mdl unless mdl.empty?
613: 
614:         secdata
615:       end
616: 
617:       @values
618:     end

[Source]

     # File generator.rb, line 574
574:     def value_hash
575:       class_attribute_values
576:       add_table_of_sections
577: 
578:       @values["charset"] = @options.charset
579:       @values["style_url"] = style_url(path, @options.css)
580:       @values["mathml_xsl_url"] = style_url(path, "mathml.xsl")
581: 
582:       d = markup(@context.comment)
583:       @values["description"] = d unless d.empty?
584: 
585:       ml = build_method_summary_list
586:       @values["methods"] = ml unless ml.empty?
587: 
588:       il = build_include_list(@context)
589:       @values["includes"] = il unless il.empty?
590: 
591:       @values["sections"] = @context.sections.map do |section|
592: 
593:         secdata = {
594:           "sectitle" => section.title,
595:           "secsequence" => section.sequence,
596:           "seccomment" => markup(section.comment)
597:         }
598: 
599:         al = build_alias_summary_list(section)
600:         secdata["aliases"] = al unless al.empty?
601: 
602:         co = build_constants_summary_list(section)
603:         secdata["constants"] = co unless co.empty?
604: 
605:         al = build_attribute_list(section)
606:         secdata["attributes"] = al unless al.empty?
607: 
608:         cl = build_class_list(0, @context, section)
609:         secdata["classlist"] = cl unless cl.empty?
610: 
611:         mdl = build_method_detail_list(section)
612:         secdata["method_list"] = mdl unless mdl.empty?
613: 
614:         secdata
615:       end
616: 
617:       @values
618:     end

[Source]

     # File generator.rb, line 566
566:     def write_on(f)
567:       value_hash
568:       template = RDoc::TemplatePage.new(@template::BODY,
569:                                         @template::CLASS_PAGE,
570:                                         @template::METHOD_LIST)
571:       template.write_html_on(f, @values)
572:     end

[Source]

     # File doc-tmp/rdoc/generator.rb, line 566
566:     def write_on(f)
567:       value_hash
568:       template = RDoc::TemplatePage.new(@template::BODY,
569:                                         @template::CLASS_PAGE,
570:                                         @template::METHOD_LIST)
571:       template.write_html_on(f, @values)
572:     end

[Validate]