| Class | Generators::HtmlClass |
| In: |
rdoc/generators/html_generator.rb
|
| Parent: | ContextUser |
Wrap a ClassModule context
Attributes
| path | [R] |
Public Class methods
# File rdoc/generators/html_generator.rb, line 583
583: def initialize(context, html_file, prefix, options)
584: super(context, options)
585:
586: @html_file = html_file
587: @is_module = context.is_module?
588: @values = {}
589:
590: context.viewer = self
591:
592: if options.all_one_file
593: @path = context.full_name
594: else
595: @path = http_url(context.full_name, prefix)
596: end
597:
598: collect_methods
599:
600: AllReferences.add(name, self)
601: end
Public Instance methods
# File rdoc/generators/html_generator.rb, line 749
749: def <=>(other)
750: self.name <=> other.name
751: end
# File rdoc/generators/html_generator.rb, line 679
679: def build_attribute_list(section)
680: atts = @context.attributes.sort
681: res = []
682: atts.each do |att|
683: next unless att.section == section
684: if att.visibility == :public || att.visibility == :protected || @options.show_all
685: entry = {
686: "name" => CGI.escapeHTML(att.name),
687: "rw" => att.rw,
688: "a_desc" => markup(att.comment, true)
689: }
690: unless att.visibility == :public || att.visibility == :protected
691: entry["rw"] << "-"
692: end
693: res << entry
694: end
695: end
696: res
697: end
# File rdoc/generators/html_generator.rb, line 699
699: def class_attribute_values
700: h_name = CGI.escapeHTML(name)
701:
702: @values["classmod"] = @is_module ? "Module" : "Class"
703: @values["title"] = "#{@values['classmod']}: #{h_name}"
704:
705: c = @context
706: c = c.parent while c and !c.diagram
707: if c && c.diagram
708: @values["diagram"] = diagram_reference(c.diagram)
709: end
710:
711: @values["full_name"] = h_name
712:
713: parent_class = @context.superclass
714:
715: if parent_class
716: @values["parent"] = CGI.escapeHTML(parent_class)
717:
718: if parent_name
719: lookup = parent_name + "::" + parent_class
720: else
721: lookup = parent_class
722: end
723:
724: parent_url = AllReferences[lookup] || AllReferences[parent_class]
725:
726: if parent_url and parent_url.document_self
727: @values["par_url"] = aref_to(parent_url.path)
728: end
729: end
730:
731: files = []
732: @context.in_files.each do |f|
733: res = {}
734: full_path = CGI.escapeHTML(f.file_absolute_name)
735:
736: res["full_path"] = full_path
737: res["full_path_url"] = aref_to(f.viewer.path) if f.document_self
738:
739: if @options.webcvs
740: res["cvsurl"] = cvs_url( @options.webcvs, full_path )
741: end
742:
743: files << res
744: end
745:
746: @values['infiles'] = files
747: end
return the relative file name to store this class in, which is also its url
# File rdoc/generators/html_generator.rb, line 605
605: def http_url(full_name, prefix)
606: path = full_name.dup
607: if path['<<']
608: path.gsub!(/<<\s*(\w*)/) { "from-#$1" }
609: end
610: File.join(prefix, path.split("::")) + ".html"
611: end
# File rdoc/generators/html_generator.rb, line 618
618: def parent_name
619: @context.parent.full_name
620: end
# File rdoc/generators/html_generator.rb, line 634
634: def value_hash
635: class_attribute_values
636: add_table_of_sections
637:
638: @values["charset"] = @options.charset
639: @values["style_url"] = style_url(path, @options.css)
640:
641: d = markup(@context.comment)
642: @values["description"] = d unless d.empty?
643:
644: ml = build_method_summary_list
645: @values["methods"] = ml unless ml.empty?
646:
647: il = build_include_list(@context)
648: @values["includes"] = il unless il.empty?
649:
650: @values["sections"] = @context.sections.map do |section|
651:
652: secdata = {
653: "sectitle" => section.title,
654: "secsequence" => section.sequence,
655: "seccomment" => markup(section.comment)
656: }
657:
658: al = build_alias_summary_list(section)
659: secdata["aliases"] = al unless al.empty?
660:
661: co = build_constants_summary_list(section)
662: secdata["constants"] = co unless co.empty?
663:
664: al = build_attribute_list(section)
665: secdata["attributes"] = al unless al.empty?
666:
667: cl = build_class_list(0, @context, section)
668: secdata["classlist"] = cl unless cl.empty?
669:
670: mdl = build_method_detail_list(section)
671: secdata["method_list"] = mdl unless mdl.empty?
672:
673: secdata
674: end
675:
676: @values
677: end