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 632
632:     def initialize(context, html_file, prefix, options)
633:       super(context, options)
634: 
635:       @html_file = html_file
636:       @is_module = context.is_module?
637:       @values    = {}
638: 
639:       context.viewer = self
640: 
641:       if options.all_one_file
642:         @path = context.full_name
643:       else
644:         @path = http_url(context.full_name, prefix)
645:       end
646: 
647:       collect_methods
648: 
649:       AllReferences.add(name, self)
650:     end

Public Instance methods

[Source]

     # File generators/html_generator.rb, line 798
798:     def <=>(other)
799:       self.name <=> other.name
800:     end

[Source]

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

[Source]

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

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

[Source]

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

[Source]

     # File generators/html_generator.rb, line 671
671:     def index_name
672:       name
673:     end

[Source]

     # File generators/html_generator.rb, line 663
663:     def name
664:       @context.full_name
665:     end

[Source]

     # File generators/html_generator.rb, line 667
667:     def parent_name
668:       @context.parent.full_name
669:     end

[Source]

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

[Source]

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

[Validate]