In Files

Parent

Methods

Files

RI::ClassDescription

Public Instance Methods

to_html(container_tag="div", header_tag="h1", methods_header_tag="h2", methods_tag="p") click to toggle source

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.

# File lib/ihelp.rb, line 873
def to_html(container_tag="div", header_tag="h1",
            methods_header_tag="h2", methods_tag="p")
  doc = REXML::Document.new
  root = doc.add_element(container_tag)
  header = root.add_element(header_tag)
  header.add_text(full_name)
  comment.each{|c|
    root.add_element( c.to_html.root )
  }
  root.add_element(methods_header_tag).add_text("Class Methods")
  cmethods = root.add_element(methods_tag)
  class_methods[0...-1].each{|m|
    cmethods.add(m.to_html.root)
    cmethods.add_text(", ")
  }
  cmethods.add(class_methods.last.to_html.root)
  root.add_element(methods_header_tag).add_text("Instance Methods")
  imethods = root.add_element(methods_tag)
  instance_methods[0...-1].each{|m|
    imethods.add(m.to_html.root)
    imethods.add_text(", ")
  }
  imethods.add(instance_methods.last.to_html.root)
  doc
end
to_text() click to toggle source
# File lib/ihelp.rb, line 899
def to_text
  segs = [full_name]
  segs += (comment || []).map{|c| c.to_text }
  segs << "" << "Class methods: " << (class_methods || []).map{|m| m.to_text }.join(", ")
  segs << "" << "Instance methods: " << (instance_methods || []).map{|m| m.to_text }.join(", ")
  segs << "" << "Constants: " << (constants || []).map{|m| m.to_text }.join("\n")
  segs << "" << "Attributes: " << (attributes || []).map{|m| m.to_text }.join("\n")
  segs.join("\n")
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.