| Class | Generators::HtmlClass |
| In: |
generators/html_generator.rb
|
| Parent: | ContextUser |
Wrap a ClassModule context
| path | [R] |
# File generators/html_generator.rb, line 634
634: def initialize(context, html_file, prefix, options)
635: super(context, options)
636:
637: @html_file = html_file
638: @is_module = context.is_module?
639: @values = {}
640:
641: context.viewer = self
642:
643: if options.all_one_file
644: @path = context.full_name
645: else
646: @path = http_url(context.full_name, prefix)
647: end
648:
649: collect_methods
650:
651: AllReferences.add(name, self)
652: end
# File generators/html_generator.rb, line 800
800: def <=>(other)
801: self.name <=> other.name
802: end
# File generators/html_generator.rb, line 730
730: def build_attribute_list(section)
731: atts = @context.attributes.sort
732: res = []
733: atts.each do |att|
734: next unless att.section == section
735: if att.visibility == :public || att.visibility == :protected || @options.show_all
736: entry = {
737: "name" => CGI.escapeHTML(att.name),
738: "rw" => att.rw,
739: "a_desc" => markup(att.comment, true)
740: }
741: unless att.visibility == :public || att.visibility == :protected
742: entry["rw"] << "-"
743: end
744: res << entry
745: end
746: end
747: res
748: end
# File generators/html_generator.rb, line 750
750: def class_attribute_values
751: h_name = CGI.escapeHTML(name)
752:
753: @values["classmod"] = @is_module ? "Module" : "Class"
754: @values["title"] = "#{@values['classmod']}: #{h_name}"
755:
756: c = @context
757: c = c.parent while c and !c.diagram
758: if c && c.diagram
759: @values["diagram"] = diagram_reference(c.diagram)
760: end
761:
762: @values["full_name"] = h_name
763:
764: parent_class = @context.superclass
765:
766: if parent_class
767: @values["parent"] = CGI.escapeHTML(parent_class)
768:
769: if parent_name
770: lookup = parent_name + "::" + parent_class
771: else
772: lookup = parent_class
773: end
774:
775: parent_url = AllReferences[lookup] || AllReferences[parent_class]
776:
777: if parent_url and parent_url.document_self
778: @values["par_url"] = aref_to(parent_url.path)
779: end
780: end
781:
782: files = []
783: @context.in_files.each do |f|
784: res = {}
785: full_path = CGI.escapeHTML(f.file_absolute_name)
786:
787: res["full_path"] = full_path
788: res["full_path_url"] = aref_to(f.viewer.path) if f.document_self
789:
790: if @options.webcvs
791: res["cvsurl"] = cvs_url( @options.webcvs, full_path )
792: end
793:
794: files << res
795: end
796:
797: @values['infiles'] = files
798: end
return the relative file name to store this class in, which is also its url
# File generators/html_generator.rb, line 656
656: def http_url(full_name, prefix)
657: path = full_name.dup
658: if path['<<']
659: path.gsub!(/<<\s*(\w*)/) { "from-#$1" }
660: end
661: File.join(prefix, path.split("::")) + '.' + @options.template
662: end
# File generators/html_generator.rb, line 669
669: def parent_name
670: @context.parent.full_name
671: end
# File generators/html_generator.rb, line 685
685: def value_hash
686: class_attribute_values
687: add_table_of_sections
688:
689: @values["charset"] = @options.charset
690: @values["style_url"] = style_url(path, @options.css)
691:
692: d = markup(@context.comment)
693: @values["description"] = d unless d.empty?
694:
695: ml = build_method_summary_list
696: @values["methods"] = ml unless ml.empty?
697:
698: il = build_include_list(@context)
699: @values["includes"] = il unless il.empty?
700:
701: @values["sections"] = @context.sections.map do |section|
702:
703: secdata = {
704: "sectitle" => section.title,
705: "secsequence" => section.sequence,
706: "seccomment" => markup(section.comment)
707: }
708:
709: al = build_alias_summary_list(section)
710: secdata["aliases"] = al unless al.empty?
711:
712: co = build_constants_summary_list(section)
713: secdata["constants"] = co unless co.empty?
714:
715: al = build_attribute_list(section)
716: secdata["attributes"] = al unless al.empty?
717:
718: cl = build_class_list(0, @context, section)
719: secdata["classlist"] = cl unless cl.empty?
720:
721: mdl = build_method_detail_list(section)
722: secdata["method_list"] = mdl unless mdl.empty?
723:
724: secdata
725: end
726:
727: @values
728: end