Module: BerkeleyLibrary::Util::XLSX::RubyXLWorksheetExtensions

Included in:
RubyXL::Worksheet
Defined in:
lib/berkeley_library/util/xlsx/rubyxl_worksheet_extensions.rb

Instance Method Summary collapse

Instance Method Details

#first_blank_column_indexObject



8
9
10
11
12
13
14
15
16
# File 'lib/berkeley_library/util/xlsx/rubyxl_worksheet_extensions.rb', line 8

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