Sha256: ce8e77e566cff96a2a8c0a3675796d1f207cd1842e92e3761a23898243277646

Contents?: true

Size: 643 Bytes

Versions: 4

Compression:

Stored size: 643 Bytes

Contents

require 'google_drive'
require_relative 'gdoc_trans'

class GdocTransWriter
  attr_accessor :worksheet

  def initialize(worksheet)
    @worksheet = worksheet
  end

  def write(row, column, data)
    @worksheet[row, GdocTrans::WORKSHEET_COLUMNS[column.to_sym]] = data
  end

  def shift_up(old_row_num, rows_count)
    # shift up that many times we're missing till the end
    (old_row_num..rows_count).to_a.each do |new_row|
      (1..worksheet.num_cols).to_a.each do |col|
        cell = @worksheet[new_row, col]
        @worksheet[new_row, col] = ''
        @worksheet[new_row + 1, col] = cell
      end
    end

    @worksheet
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
transync-1.0.0 lib/transync/gdoc_trans/gdoc_trans_writer.rb
transync-0.1.1 lib/transync/gdoc_trans/gdoc_trans_writer.rb
transync-0.1.0 lib/transync/gdoc_trans/gdoc_trans_writer.rb
transync-0.0.1 lib/transync/gdoc_trans/gdoc_trans_writer.rb