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

Wrap a ClassModule context

Methods

Attributes

path  [R] 

Public Class methods

[Source]

     # File generators/html_generator.rb, line 635
635:     def initialize(context, html_file, prefix, options)
636:       super(context, options)
637: 
638:       @html_file = html_file
639:       @is_module = context.is_module?
640:       @values    = {}
641: 
642:       context.viewer = self
643: 
644:       if options.all_one_file
645:         @path = context.full_name
646:       else
647:         @path = http_url(context.full_name, prefix)
648:       end
649: 
650:       collect_methods
651: 
652:       AllReferences.add(name, self)
653:     end

Public Instance methods

[Source]

     # File generators/html_generator.rb, line 801
801:     def <=>(other)
802:       self.name <=> other.name
803:     end

[Source]

     # File generators/html_generator.rb, line 731
731:     def build_attribute_list(section)
732:       atts = @context.attributes.sort
733:       res = []
734:       atts.each do |att|
735:         next unless att.section == section
736:         if att.visibility == :public || att.visibility == :protected || @options.show_all
737:           entry = {
738:             "name"   => CGI.escapeHTML(att.name), 
739:             "rw"     => att.rw, 
740:             "a_desc" => markup(att.comment, true)
741:           }
742:           unless att.visibility == :public || att.visibility == :protected
743:             entry["rw"] << "-"
744:           end
745:           res << entry
746:         end
747:       end
748:       res
749:     end

[Source]

     # File generators/html_generator.rb, line 751
751:     def class_attribute_values
752:       h_name = CGI.escapeHTML(name)
753: 
754:       @values["classmod"]  = @is_module ? "Module" : "Class"
755:       @values["title"]     = "#{@values['classmod']}: #{h_name}"
756: 
757:       c = @context
758:       c = c.parent while c and !c.diagram
759:       if c && c.diagram
760:         @values["diagram"] = diagram_reference(c.diagram)
761:       end
762: 
763:       @values["full_name"] = h_name
764: 
765:       parent_class = @context.superclass
766: 
767:       if parent_class
768:         @values["parent"] = CGI.escapeHTML(parent_class)
769: 
770:         if parent_name
771:           lookup = parent_name + "::" + parent_class
772:         else
773:           lookup = parent_class
774:         end
775: 
776:         parent_url = AllReferences[lookup] || AllReferences[parent_class]
777: 
778:         if parent_url and parent_url.document_self
779:           @values["par_url"] = aref_to(parent_url.path)
780:         end
781:       end
782: 
783:       files = []
784:       @context.in_files.each do |f|
785:         res = {}
786:         full_path = CGI.escapeHTML(f.file_absolute_name)
787: 
788:         res["full_path"]     = full_path
789:         res["full_path_url"] = aref_to(f.viewer.path) if f.document_self
790: 
791:         if @options.webcvs
792:           res["cvsurl"] = cvs_url( @options.webcvs, full_path )
793:         end
794: 
795:         files << res
796:       end
797: 
798:       @values['infiles'] = files
799:     end

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

[Source]

     # File generators/html_generator.rb, line 657
657:     def http_url(full_name, prefix)
658:       path = full_name.dup
659:       if path['<<']
660:         path.gsub!(/<<\s*(\w*)/) { "from-#$1" }
661:       end
662:       File.join(prefix, path.split("::")) + '.' + @options.template
663:     end

[Source]

     # File generators/html_generator.rb, line 674
674:     def index_name
675:       name
676:     end

[Source]

     # File generators/html_generator.rb, line 666
666:     def name
667:       @context.full_name
668:     end

[Source]

     # File generators/html_generator.rb, line 670
670:     def parent_name
671:       @context.parent.full_name
672:     end

[Source]

     # File generators/html_generator.rb, line 686
686:     def value_hash
687:       class_attribute_values
688:       add_table_of_sections
689: 
690:       @values["charset"] = @options.charset
691:       @values["style_url"] = style_url(path, @options.css)
692: 
693:       d = markup(@context.comment)
694:       @values["description"] = d unless d.empty?
695: 
696:       ml = build_method_summary_list
697:       @values["methods"] = ml unless ml.empty?
698: 
699:       il = build_include_list(@context)
700:       @values["includes"] = il unless il.empty?
701: 
702:       @values["sections"] = @context.sections.map do |section|
703: 
704:         secdata = {
705:           "sectitle" => section.title,
706:           "secsequence" => section.sequence,
707:           "seccomment" => markup(section.comment)
708:         }
709: 
710:         al = build_alias_summary_list(section)
711:         secdata["aliases"] = al unless al.empty?
712:         
713:         co = build_constants_summary_list(section)
714:         secdata["constants"] = co unless co.empty?
715:         
716:         al = build_attribute_list(section)
717:         secdata["attributes"] = al unless al.empty?
718:         
719:         cl = build_class_list(0, @context, section)
720:         secdata["classlist"] = cl unless cl.empty?
721:         
722:         mdl = build_method_detail_list(section)
723:         secdata["method_list"] = mdl unless mdl.empty?
724: 
725:         secdata
726:       end
727: 
728:       @values
729:     end

[Source]

     # File generators/html_generator.rb, line 678
678:     def write_on(f)
679:       value_hash
680:       template = TemplatePage.new(RDoc::Page::BODY,
681:                                       RDoc::Page::CLASS_PAGE,
682:                                       RDoc::Page::METHOD_LIST)
683:       template.write_html_on(f, @values)
684:     end

[Validate]