Class: OoxmlParser::TextBody

Inherits:
Object
  • Object
show all
Defined in:
lib/ooxml_parser/common_parser/common_data/alternate_content/shape/text_body/text_body.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(properties = nil, paragraphs = []) ⇒ TextBody

Returns a new instance of TextBody.



5
6
7
8
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/shape/text_body/text_body.rb', line 5

def initialize(properties = nil, paragraphs = [])
  @properties = properties
  @paragraphs = paragraphs
end

Instance Attribute Details

#paragraphsObject

Returns the value of attribute paragraphs.



3
4
5
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/shape/text_body/text_body.rb', line 3

def paragraphs
  @paragraphs
end

#propertiesObject

Returns the value of attribute properties.



3
4
5
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/shape/text_body/text_body.rb', line 3

def properties
  @properties
end

Class Method Details

.parse(text_body_node) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/shape/text_body/text_body.rb', line 10

def self.parse(text_body_node)
  text_body = TextBody.new
  text_body_node.xpath('*').each do |text_body_node_child|
    case text_body_node_child.name
    when 'p'
      text_body.paragraphs << Paragraph.parse(text_body_node_child)
    when 'bodyPr'
      text_body.properties = OOXMLShapeBodyProperties.parse(text_body_node_child)
    end
  end
  text_body
end