Class: Sheets::Parsers::NokogiriOdsParser

Inherits:
Base
  • Object
show all
Defined in:
lib/sheets/parsers/nokogiri_ods_parser.rb

Instance Method Summary collapse

Methods inherited from Base

formats, formats=, #initialize, #io, parses

Constructor Details

This class inherits a constructor from Sheets::Parsers::Base

Instance Method Details

#to_arrayObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/sheets/parsers/nokogiri_ods_parser.rb', line 7

def to_array
  rows.collect do |row|
    table_cells = []
    row.xpath('table:table-cell').each do |cell|
      repeat = cell.attributes["number-columns-repeated"].text.to_i if cell.attributes["number-columns-repeated"]
      repeat ||= 1
      repeat.times { table_cells << cell }
    end

    table_cells.collect {|cell| value_for_cell(cell) }
  end
end