Sha256: c64fe4e9d9399d777faced83e4f0bc7d025230c0ff5f1725df1043f647e708a9

Contents?: true

Size: 698 Bytes

Versions: 5

Compression:

Stored size: 698 Bytes

Contents

require 'rubyXL'
require 'berkeley_library/util/xlsx/rubyxl_cell_extensions'

module BerkeleyLibrary
  module Util
    module XLSX
      module RubyXLWorksheetExtensions
        def first_blank_column_index
          sheet_data.rows.inject(0) do |first_blank_c_index, row|
            next first_blank_c_index unless row

            trailing_blank_cells = row.cells.reverse.take_while(&:blank?)
            row_first_blank_c_index = row.size - trailing_blank_cells.size
            [first_blank_c_index, row_first_blank_c_index].max
          end
        end
      end
    end
  end
end

module RubyXL
  class Worksheet
    prepend BerkeleyLibrary::Util::XLSX::RubyXLWorksheetExtensions
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
berkeley_library-location-4.1.0 lib/berkeley_library/util/xlsx/rubyxl_worksheet_extensions.rb
berkeley_library-location-4.0.0 lib/berkeley_library/util/xlsx/rubyxl_worksheet_extensions.rb
berkeley_library-location-3.0.0 lib/berkeley_library/util/xlsx/rubyxl_worksheet_extensions.rb
berkeley_library-location-2.0.0 lib/berkeley_library/util/xlsx/rubyxl_worksheet_extensions.rb
berkeley_library-holdings-1.0.5 lib/berkeley_library/util/xlsx/rubyxl_worksheet_extensions.rb