Class: RI::MethodDescription

Inherits:
Object
  • Object
show all
Defined in:
lib/ihelp.rb

Instance Method Summary collapse

Instance Method Details

#to_html(container_tag = "div", header_tag = "h1") ⇒ Object

Creates HTML element from the MethodDescription. Uses container_tag as the root node name and header_tag as the tag for the header element that contains the method’s name.

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



845
846
847
848
849
850
851
852
853
854
# File 'lib/ihelp.rb', line 845

def to_html(container_tag="div", header_tag="h1")
  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 )
  }
  doc
end

#to_textObject



856
857
858
859
# File 'lib/ihelp.rb', line 856

def to_text
  name + " -- " + params.to_s + block_params.to_s + "\n" +
  (comment || []).map{|c| c.to_text }.join("\n")
end