Sha256: 366684908f8078a1239bae4ff90bc8495354e332003836a88732d0c85c519f96

Contents?: true

Size: 820 Bytes

Versions: 2

Compression:

Stored size: 820 Bytes

Contents

require_relative 'worksheet'

module Smerp
  module Exporter
    module Excel
      class Workbook

        attr_reader :inst
        attr_accessor :config
        def initialize(wb, config)
          @inst = wb
          @config = config
          @wsRec = {}
        end

        def worksheet(name, *args, &block)
          ws = @inst.add_worksheet(name: name)
          wsProxy = Worksheet.new(ws, @config)
          @wsRec[name] = wsProxy

          if block
            block.call(wsProxy)
          else
            ws
          end
        end

        def config=(conf)
          @config = conf
          @wsRec.each do |k,v|
            v.config = conf
          end
        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/workbook.rb
smerp-exporter-excel-0.1.0 lib/smerp/exporter/excel/workbook.rb