Class: RubyDocx::Elements::Text

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

Instance Attribute Summary collapse

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 Attribute Details

#colorObject (readonly)

Returns the value of attribute color.



3
4
5
# File 'lib/ruby_docx/elements/text.rb', line 3

def color
  @color
end

#contentObject

Returns the value of attribute content.



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

def content
  @content
end

#font_nameObject (readonly)

Returns the value of attribute font_name.



3
4
5
# File 'lib/ruby_docx/elements/text.rb', line 3

def font_name
  @font_name
end

#font_sizeObject (readonly)

Returns the value of attribute font_size.



3
4
5
# File 'lib/ruby_docx/elements/text.rb', line 3

def font_size
  @font_size
end

Instance Method Details

#elementObject



6
7
8
# File 'lib/ruby_docx/elements/text.rb', line 6

def element
  @element ||= @node.children.first
end

#to_htmlObject



26
27
28
# File 'lib/ruby_docx/elements/text.rb', line 26

def to_html
  "#{self.content.gsub(/ /, " ")}"
end

#to_sObject



22
23
24
# File 'lib/ruby_docx/elements/text.rb', line 22

def to_s
  self.content.to_s
end