Class RI::ClassDescription
In: lib/ihelp.rb
Parent: Object

Methods

to_html   to_text  

Public Instance methods

Creates HTML element from the ClassDescription. Uses container_tag as the root node name and header_tag as the tag for the header element that contains the classes name. Uses methods_header_tag as the tag for the "Class/Instance Methods" method list headers. Uses methods_tag as the tag for the method lists.

Returns a REXML document with container_tag as the root element name.

[Source]

     # File lib/ihelp.rb, line 873
873:     def to_html(container_tag="div", header_tag="h1",
874:                 methods_header_tag="h2", methods_tag="p")
875:       doc = REXML::Document.new
876:       root = doc.add_element(container_tag)
877:       header = root.add_element(header_tag)
878:       header.add_text(full_name)
879:       comment.each{|c|
880:         root.add_element( c.to_html.root )
881:       }
882:       root.add_element(methods_header_tag).add_text("Class Methods")
883:       cmethods = root.add_element(methods_tag)
884:       class_methods[0...-1].each{|m|
885:         cmethods.add(m.to_html.root)
886:         cmethods.add_text(", ")
887:       }
888:       cmethods.add(class_methods.last.to_html.root)
889:       root.add_element(methods_header_tag).add_text("Instance Methods")
890:       imethods = root.add_element(methods_tag)
891:       instance_methods[0...-1].each{|m|
892:         imethods.add(m.to_html.root)
893:         imethods.add_text(", ")
894:       }
895:       imethods.add(instance_methods.last.to_html.root)
896:       doc
897:     end

[Source]

     # File lib/ihelp.rb, line 899
899:     def to_text
900:       segs = [full_name]
901:       segs += (comment || []).map{|c| c.to_text }
902:       segs << "" << "Class methods: " << (class_methods || []).map{|m| m.to_text }.join(", ")
903:       segs << "" << "Instance methods: " << (instance_methods || []).map{|m| m.to_text }.join(", ")
904:       segs << "" << "Constants: " << (constants || []).map{|m| m.to_text }.join("\n")
905:       segs << "" << "Attributes: " << (attributes || []).map{|m| m.to_text }.join("\n")
906:       segs.join("\n")
907:     end

[Validate]