Sha256: 6fea9d5f28783e9c83b813ddafbe8c304a703163cdef17663625bcef9e191148

Contents?: true

Size: 607 Bytes

Versions: 3

Compression:

Stored size: 607 Bytes

Contents

module Roo
  module Xls
    # patch for skipping blank rows in the case of
    # having a spreadsheet with 30,000 nil rows appended
    # to the actual data.  (it happens and your RAM will love me)
    module SpreadsheetEachSkipBlanks
      def each(skip = dimensions[0])
        blanks = 0
        skip.upto(dimensions[1] - 1) do |i|
          if row(i).any?
            Proc.new.call(row(i))
          else
            blanks += 1
            blanks < 20 ? next : return
          end
        end
      end
    end
  end
end

class Spreadsheet::Worksheet
  include Roo::Xls::SpreadsheetEachSkipBlanks
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
roo-xls-1.2.0 lib/roo/xls/spreadsheet_extensions.rb
roo-xls-1.1.0 lib/roo/xls/spreadsheet_extensions.rb
roo-xls-1.0.0 lib/roo/xls/spreadsheet_extensions.rb