Class: Paragraph
- Inherits:
-
DocItem
- Object
- TextLineBuilderContext
- TextLine
- DocItem
- Paragraph
- Defined in:
- lib/almirah/doc_items/paragraph.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#text ⇒ Object
Returns the value of attribute text.
Attributes inherited from DocItem
Instance Method Summary collapse
- #getTextWithoutSpaces ⇒ Object
-
#initialize(doc, text) ⇒ Paragraph
constructor
A new instance of Paragraph.
- #to_html ⇒ Object
Methods inherited from DocItem
Methods inherited from TextLine
add_lazy_doc_id, #bold, #bold_and_italic, #format_string, #italic, #link
Methods inherited from TextLineBuilderContext
#bold, #bold_and_italic, #italic, #link
Constructor Details
#initialize(doc, text) ⇒ Paragraph
Returns a new instance of Paragraph.
6 7 8 9 |
# File 'lib/almirah/doc_items/paragraph.rb', line 6 def initialize(doc, text) super(doc) @text = text.strip end |
Instance Attribute Details
#text ⇒ Object
Returns the value of attribute text.
4 5 6 |
# File 'lib/almirah/doc_items/paragraph.rb', line 4 def text @text end |
Instance Method Details
#getTextWithoutSpaces ⇒ Object
11 12 13 |
# File 'lib/almirah/doc_items/paragraph.rb', line 11 def getTextWithoutSpaces @text.split.join('-').downcase end |
#to_html ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/almirah/doc_items/paragraph.rb', line 15 def to_html s = '' if @@html_table_render_in_progress s += '</table>' @@html_table_render_in_progress = false end s += "<p>#{format_string(@text)}" s end |