Class Generators::HtmlClass
In: lib/rdoc/generators/html_generator.rb
Parent: ContextUser

Wrap a ClassModule context

Methods

Attributes

path  [R] 

Public Class methods

[Source]

     # File lib/rdoc/generators/html_generator.rb, line 590
590:     def initialize(context, html_file, prefix, options)
591:       super(context, options)
592: 
593:       @html_file = html_file
594:       @is_module = context.is_module?
595:       @values    = {}
596: 
597:       context.viewer = self
598: 
599:       if options.all_one_file
600:         @path = context.full_name
601:       else
602:         @path = http_url(context.full_name, prefix)
603:       end
604: 
605:       collect_methods
606: 
607:       AllReferences.add(name, self)
608:     end

Public Instance methods

[Source]

     # File lib/rdoc/generators/html_generator.rb, line 756
756:     def <=>(other)
757:       self.name <=> other.name
758:     end

[Source]

     # File lib/rdoc/generators/html_generator.rb, line 686
686:     def build_attribute_list(section)
687:       atts = @context.attributes.sort
688:       res = []
689:       atts.each do |att|
690:         next unless att.section == section
691:         if att.visibility == :public || att.visibility == :protected || @options.show_all
692:           entry = {
693:             "name"   => CGI.escapeHTML(att.name), 
694:             "rw"     => att.rw, 
695:             "a_desc" => markup(att.comment, true)
696:           }
697:           unless att.visibility == :public || att.visibility == :protected
698:             entry["rw"] << "-"
699:           end
700:           res << entry
701:         end
702:       end
703:       res
704:     end

[Source]

     # File lib/rdoc/generators/html_generator.rb, line 706
706:     def class_attribute_values
707:       h_name = CGI.escapeHTML(name)
708: 
709:       @values["classmod"]  = @is_module ? "Module" : "Class"
710:       @values["title"]     = "#{@values['classmod']}: #{h_name}"
711: 
712:       c = @context
713:       c = c.parent while c and !c.diagram
714:       if c && c.diagram
715:         @values["diagram"] = diagram_reference(c.diagram)
716:       end
717: 
718:       @values["full_name"] = h_name
719: 
720:       parent_class = @context.superclass
721: 
722:       if parent_class
723:         @values["parent"] = CGI.escapeHTML(parent_class)
724: 
725:         if parent_name
726:           lookup = parent_name + "::" + parent_class
727:         else
728:           lookup = parent_class
729:         end
730: 
731:         parent_url = AllReferences[lookup] || AllReferences[parent_class]
732: 
733:         if parent_url and parent_url.document_self
734:           @values["par_url"] = aref_to(parent_url.path)
735:         end
736:       end
737: 
738:       files = []
739:       @context.in_files.each do |f|
740:         res = {}
741:         full_path = CGI.escapeHTML(f.file_absolute_name)
742: 
743:         res["full_path"]     = full_path
744:         res["full_path_url"] = aref_to(f.viewer.path) if f.document_self
745: 
746:         if @options.webcvs
747:           res["cvsurl"] = cvs_url( @options.webcvs, full_path )
748:         end
749: 
750:         files << res
751:       end
752: 
753:       @values['infiles'] = files
754:     end

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

[Source]

     # File lib/rdoc/generators/html_generator.rb, line 612
612:     def http_url(full_name, prefix)
613:       path = full_name.dup
614:       if path['<<']
615:         path.gsub!(/<<\s*(\w*)/) { "from-#$1" }
616:       end
617:       File.join(prefix, path.split("::")) + ".html"
618:     end

[Source]

     # File lib/rdoc/generators/html_generator.rb, line 629
629:     def index_name
630:       name
631:     end

[Source]

     # File lib/rdoc/generators/html_generator.rb, line 621
621:     def name
622:       @context.full_name
623:     end

[Source]

     # File lib/rdoc/generators/html_generator.rb, line 625
625:     def parent_name
626:       @context.parent.full_name
627:     end

[Source]

     # File lib/rdoc/generators/html_generator.rb, line 641
641:     def value_hash
642:       class_attribute_values
643:       add_table_of_sections
644: 
645:       @values["charset"] = @options.charset
646:       @values["style_url"] = style_url(path, @options.css)
647: 
648:       d = markup(@context.comment)
649:       @values["description"] = d unless d.empty?
650: 
651:       ml = build_method_summary_list
652:       @values["methods"] = ml unless ml.empty?
653: 
654:       il = build_include_list(@context)
655:       @values["includes"] = il unless il.empty?
656: 
657:       @values["sections"] = @context.sections.map do |section|
658: 
659:         secdata = {
660:           "sectitle" => section.title,
661:           "secsequence" => section.sequence,
662:           "seccomment" => markup(section.comment)
663:         }
664: 
665:         al = build_alias_summary_list(section)
666:         secdata["aliases"] = al unless al.empty?
667:         
668:         co = build_constants_summary_list(section)
669:         secdata["constants"] = co unless co.empty?
670:         
671:         al = build_attribute_list(section)
672:         secdata["attributes"] = al unless al.empty?
673:         
674:         cl = build_class_list(0, @context, section)
675:         secdata["classlist"] = cl unless cl.empty?
676:         
677:         mdl = build_method_detail_list(section)
678:         secdata["method_list"] = mdl unless mdl.empty?
679: 
680:         secdata
681:       end
682: 
683:       @values
684:     end

[Source]

     # File lib/rdoc/generators/html_generator.rb, line 633
633:     def write_on(f)
634:       value_hash
635:       template = TemplatePage.new(RDoc::Page::BODY,
636:                                       RDoc::Page::CLASS_PAGE,
637:                                       RDoc::Page::METHOD_LIST)
638:       template.write_html_on(f, @values)
639:     end

[Validate]