Class: Paragraph

Inherits:
DocItem show all
Defined in:
lib/almirah/doc_items/paragraph.rb

Direct Known Subclasses

ControlledParagraph, Heading

Instance Attribute Summary collapse

Attributes inherited from DocItem

#parent_doc, #parent_heading

Instance Method Summary collapse

Methods inherited from DocItem

#get_url

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

#textObject

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

#getTextWithoutSpacesObject



11
12
13
# File 'lib/almirah/doc_items/paragraph.rb', line 11

def getTextWithoutSpaces
  @text.split.join('-').downcase
end

#to_htmlObject



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