Sha256: f237267d362bcba3aa81e3e095dc1a832af1d4d073b476403d3752e48082cff3

Contents?: true

Size: 888 Bytes

Versions: 2

Compression:

Stored size: 888 Bytes

Contents


module Smerp
  module Exporter
    module Excel
      class Worksheet

        attr_reader :inst
        attr_accessor :config
        def initialize(ws, config)
          @inst = ws
          @config = config
          @curRow = 0
          @curCol = 0

          if @config.start_row != @curRow
            (0...@config.start_row-1).each do |i|
              @inst.add_row
            end
          end
          
        end

        def start_col=(col)
          @config.start_col = col
        end

        def insert_row(val = [], *args, &block)

          if @config.start_col != 0
            patch = Array.new(@config.start_col).collect { |e| "" }
            val = patch.concat(val)
          end
          @inst.add_row(val, *args) 
        end

        def method_missing(mtd, *args, &block)
          @inst.send(mtd, *args, &block)
        end

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
smerp-exporter-excel-0.1.1 lib/smerp/exporter/excel/worksheet.rb
smerp-exporter-excel-0.1.0 lib/smerp/exporter/excel/worksheet.rb