Class: OoxmlParser::GridSpan

Inherits:
Object
  • Object
show all
Defined in:
lib/ooxml_parser/common_parser/common_data/table/row/cell/merge.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type = 'horizontal', value = nil, count_of_merged_cells = 2) ⇒ GridSpan

Returns a new instance of GridSpan.



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

def initialize(type = 'horizontal', value = nil, count_of_merged_cells = 2)
  @type = type
  @count_of_merged_cells = count_of_merged_cells
  @value = value
end

Instance Attribute Details

#count_of_merged_cellsObject Also known as: count_rows_in_span

Returns the value of attribute count_of_merged_cells.



3
4
5
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/merge.rb', line 3

def count_of_merged_cells
  @count_of_merged_cells
end

#typeObject

Returns the value of attribute type.



3
4
5
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/merge.rb', line 3

def type
  @type
end

#valueObject

Returns the value of attribute value.



3
4
5
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/merge.rb', line 3

def value
  @value
end

Instance Method Details

#parse(node) ⇒ GridSpan

Parse Grid Span data

Parameters:

  • node (Nokogiri::XML:Element)

    with GridSpan data

Returns:



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

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