Class: Paragraph
- Inherits:
-
DocItem
- Object
- TextLineBuilderContext
- TextLine
- DocItem
- Paragraph
- Defined in:
- lib/almirah/doc_items/paragraph.rb
Overview
<REQ> Implementa a non-controlled paragraph as a subclass of the DocItem >[SRS-004] </REQ>
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.
7 8 9 10 |
# File 'lib/almirah/doc_items/paragraph.rb', line 7 def initialize(doc, text) super(doc) @text = text.strip end |
Instance Attribute Details
#text ⇒ Object
Returns the value of attribute text.
5 6 7 |
# File 'lib/almirah/doc_items/paragraph.rb', line 5 def text @text end |
Instance Method Details
#getTextWithoutSpaces ⇒ Object
12 13 14 |
# File 'lib/almirah/doc_items/paragraph.rb', line 12 def getTextWithoutSpaces @text.split.join('-').downcase end |
#to_html ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/almirah/doc_items/paragraph.rb', line 16 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 |