Class: RubyDocx::Elements::Paragraph

Inherits:
Element
  • Object
show all
Defined in:
lib/ruby_docx/elements/paragraph.rb

Instance Attribute Summary

Attributes inherited from Element

#doc, #grid, #node, #style

Instance Method Summary collapse

Methods inherited from Element

#elements, #initialize, #inspect, #to_xml

Constructor Details

This class inherits a constructor from RubyDocx::Elements::Element

Instance Method Details

#to_htmlObject



8
9
10
11
12
13
14
15
# File 'lib/ruby_docx/elements/paragraph.rb', line 8

def to_html
  if self.elements.size <= 0
    "<p>&nbsp;</p>"
  else
    "<p>#{self.elements.map(&:to_html).join}</p>"
  end

end

#to_sObject



4
5
6
# File 'lib/ruby_docx/elements/paragraph.rb', line 4

def to_s
  "#{self.elements.map(&:to_s).join}"
end