Class: OoxmlParser::OldDocxPicture

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#dataObject

Returns the value of attribute data.



7
8
9
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/picture/old_docx_picture.rb', line 7

def data
  @data
end

#style_numberObject

Returns the value of attribute style_number.



7
8
9
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/picture/old_docx_picture.rb', line 7

def style_number
  @style_number
end

#typeObject

Returns the value of attribute type.



7
8
9
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/picture/old_docx_picture.rb', line 7

def type
  @type
end

Class Method Details

.parse(picture_node) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/picture/old_docx_picture.rb', line 9

def self.parse(picture_node)
  picture = OldDocxPicture.new
  picture_node.xpath('*').each do |picture_node_child|
    case picture_node_child.name
    when 'shape'
      picture.type = :shape
      picture.data = OldDocxShape.parse(picture_node_child)
    when 'group'
      picture.type = :group
      picture.data = OldDocxGroup.parse(picture_node_child)
    when 'style'
      picture.style_number = picture_node_child.attribute('val').value.to_i
    end
  end
  picture
end