Class: OoxmlParser::CommonNonVisualProperties

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/common_non_visual_properties.rb

Overview

Class for ‘cNvPr` data

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, #boolean_attribute_value, #initialize, #parse_xml, #with_data?

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

This class inherits a constructor from OoxmlParser::OOXMLDocumentObject

Instance Attribute Details

#descriptionString

Returns description of shape.

Returns:

  • (String)

    description of shape



10
11
12
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/common_non_visual_properties.rb', line 10

def description
  @description
end

Returns the value of attribute hyperlink_for_hover.



6
7
8
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/common_non_visual_properties.rb', line 6

def hyperlink_for_hover
  @hyperlink_for_hover
end

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/common_non_visual_properties.rb', line 6

def id
  @id
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/common_non_visual_properties.rb', line 6

def name
  @name
end

Returns the value of attribute on_click_hyperlink.



6
7
8
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/common_non_visual_properties.rb', line 6

def on_click_hyperlink
  @on_click_hyperlink
end

#titleString

Returns title of shape.

Returns:

  • (String)

    title of shape



8
9
10
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/common_non_visual_properties.rb', line 8

def title
  @title
end

Instance Method Details

#parse(node) ⇒ CommonNonVisualProperties

Parse CommonNonVisualProperties object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/common_non_visual_properties.rb', line 15

def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'name'
      @name = value.value
    when 'id'
      @id = value.value
    when 'title'
      @title = value.value
    when 'descr'
      @description = value.value
    end
  end

  node.xpath('*').each do |node_child|
    case node_child.name
    when 'hlinkClick'
      @on_click_hyperlink = Hyperlink.new(parent: self).parse(node_child)
    when 'hlinkHover'
      @hyperlink_for_hover = Hyperlink.new(parent: self).parse(node_child)
    end
  end
  self
end