Class: OoxmlParser::GridSpan

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/common_parser/common_data/table/row/cell/grid_span.rb

Overview

Class for describing ‘gridSpan` tag

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

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

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

#initialize(parent: nil) ⇒ GridSpan

Returns a new instance of GridSpan.



11
12
13
14
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/grid_span.rb', line 11

def initialize(parent: nil)
  @type = 'horizontal'
  super
end

Instance Attribute Details

#typeString (readonly)

Returns type of grid span.

Returns:

  • (String)

    type of grid span



7
8
9
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/grid_span.rb', line 7

def type
  @type
end

#valueString (readonly)

Returns value of grid span merged cells.

Returns:

  • (String)

    value of grid span merged cells



9
10
11
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/grid_span.rb', line 9

def value
  @value
end

Instance Method Details

#parse(node) ⇒ GridSpan

Parse Grid Span data

Parameters:

  • node (Nokogiri::XML:Element)

    with GridSpan data

Returns:



19
20
21
22
23
24
25
26
27
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/grid_span.rb', line 19

def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'val'
      @value = value.value.to_i
    end
  end
  self
end