Class: RDocF95::Generator::Class
Overview
Wrap a ClassModule context
Instance Attribute Summary collapse
Attributes inherited from Context
#context
Instance Method Summary
collapse
Methods inherited from Context
#add_table_of_sections, #aref_to, #as_href, #build_alias_summary_list, build_class_list, #build_class_list, #build_constants_summary_list, #build_include_list, build_indicies, #build_method_detail_list, #build_method_summary_list, #build_requires_list, #collect_methods, #diagram_reference, #document_self, #find_file, #find_symbol, #href, #potentially_referenced_list, #url
Methods included from MarkUp
#cvs_url, #markup, #style_url
Constructor Details
#initialize(context, html_file, prefix, options) ⇒ Class
Returns a new instance of Class.
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
|
# File 'lib/rdoc-f95/generator.rb', line 520
def initialize(context, html_file, prefix, options)
super(context, options)
@html_file = html_file
@is_module = context.is_module?
@values = {}
context.viewer = self
if options.all_one_file
@path = context.full_name
else
@path = http_url(context.full_name, prefix)
end
collect_methods
AllReferences.add(name, self)
end
|
Instance Attribute Details
#methods ⇒ Object
Returns the value of attribute methods.
517
518
519
|
# File 'lib/rdoc-f95/generator.rb', line 517
def methods
@methods
end
|
#path ⇒ Object
Returns the value of attribute path.
518
519
520
|
# File 'lib/rdoc-f95/generator.rb', line 518
def path
@path
end
|
Instance Method Details
#<=>(other) ⇒ Object
691
692
693
|
# File 'lib/rdoc-f95/generator.rb', line 691
def <=>(other)
self.name <=> other.name
end
|
#build_attribute_list(section) ⇒ Object
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
|
# File 'lib/rdoc-f95/generator.rb', line 620
def build_attribute_list(section)
atts = @context.attributes.sort
res = []
atts.each do |att|
next unless att.section == section
if att.visibility == :public || att.visibility == :protected || @options.show_all
entry = {
"name" => CGI.escapeHTML(att.name),
"rw" => att.rw,
"a_desc" => markup(att., true)
}
unless att.visibility == :public || att.visibility == :protected
entry["rw"] << "-"
end
res << entry
end
end
res
end
|
#class_attribute_values ⇒ Object
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
|
# File 'lib/rdoc-f95/generator.rb', line 640
def class_attribute_values
h_name = CGI.escapeHTML(name)
@values["path"] = @path
@values["classmod"] = @is_module ? "Module" : "Class"
@values["title"] = "#{@values['classmod']}: #{h_name}"
c = @context
c = c.parent while c and !c.diagram
if c && c.diagram
@values["diagram"] = diagram_reference(c.diagram)
end
@values["full_name"] = h_name
parent_class = @context.superclass
if parent_class
@values["parent"] = CGI.escapeHTML(parent_class)
if parent_name
lookup = parent_name + "::" + parent_class
else
lookup = parent_class
end
parent_url = AllReferences[lookup] || AllReferences[parent_class]
if parent_url and parent_url.document_self
@values["par_url"] = aref_to(parent_url.path)
end
end
files = []
@context.in_files.each do |f|
res = {}
full_path = CGI.escapeHTML(f.file_absolute_name)
res["full_path"] = full_path
res["full_path_url"] = aref_to(f.viewer.path) if f.document_self
if @options.webcvs
res["cvsurl"] = cvs_url( @options.webcvs, full_path )
end
files << res
end
@values['infiles'] = files
end
|
#http_url(full_name, prefix) ⇒ Object
Returns the relative file name to store this class in, which is also its url
544
545
546
547
548
549
550
551
552
|
# File 'lib/rdoc-f95/generator.rb', line 544
def http_url(full_name, prefix)
path = full_name.dup
path.gsub!(/<<\s*(\w*)/, 'from-\1') if path['<<']
suffix = ".html"
suffix = ".xhtml" if @options.template == "xhtml"
::File.join(prefix, path.split("::")) + suffix
end
|
#index_name ⇒ Object
562
563
564
|
# File 'lib/rdoc-f95/generator.rb', line 562
def index_name
name
end
|
#name ⇒ Object
554
555
556
|
# File 'lib/rdoc-f95/generator.rb', line 554
def name
@context.full_name
end
|
#parent_name ⇒ Object
558
559
560
|
# File 'lib/rdoc-f95/generator.rb', line 558
def parent_name
@context.parent.full_name
end
|
#value_hash ⇒ Object
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
|
# File 'lib/rdoc-f95/generator.rb', line 574
def value_hash
class_attribute_values
add_table_of_sections
@values["charset"] = @options.charset
@values["style_url"] = style_url(path, @options.css)
@values["mathml_xsl_url"] = style_url(path, "mathml.xsl")
d = markup(@context.)
@values["description"] = d unless d.empty?
ml = build_method_summary_list
@values["methods"] = ml unless ml.empty?
il = build_include_list(@context)
@values["includes"] = il unless il.empty?
@values["sections"] = @context.sections.map do |section|
secdata = {
"sectitle" => section.title,
"secsequence" => section.sequence,
"seccomment" => markup(section.)
}
al = build_alias_summary_list(section)
secdata["aliases"] = al unless al.empty?
co = build_constants_summary_list(section)
secdata["constants"] = co unless co.empty?
al = build_attribute_list(section)
secdata["attributes"] = al unless al.empty?
cl = build_class_list(0, @context, section)
secdata["classlist"] = cl unless cl.empty?
mdl = build_method_detail_list(section)
secdata["method_list"] = mdl unless mdl.empty?
secdata
end
@values
end
|
#write_on(f) ⇒ Object
566
567
568
569
570
571
572
|
# File 'lib/rdoc-f95/generator.rb', line 566
def write_on(f)
value_hash
template = RDocF95::TemplatePage.new(@template::BODY,
@template::CLASS_PAGE,
@template::METHOD_LIST)
template.write_html_on(f, @values)
end
|