Class: Propolize::Heading

Inherits:
DocumentComponent show all
Defined in:
lib/propolize.rb

Overview

A secondary heading (which can appear in the appendix)

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ Heading

Returns a new instance of Heading.



716
717
718
# File 'lib/propolize.rb', line 716

def initialize(text)
  @text = text
end

Instance Method Details

#to_sObject



720
721
722
# File 'lib/propolize.rb', line 720

def to_s
  return "Heading: #{@text}"
end

#toHtmlObject



730
731
732
# File 'lib/propolize.rb', line 730

def toHtml
  return "<h2>#{@document.processText(@text)}</h2>"
end

#writeToDocument(document) ⇒ Object

write to document by adding a heading (which is only valid if we are in the appendix)



725
726
727
728
# File 'lib/propolize.rb', line 725

def writeToDocument(document)
  document.addHeading(self)
  @document = document
end