Sha256: 1cdeb0bc43826af98ae1eb6488807a20833d12486bba0cbdcdc4d6634f436710

Contents?: true

Size: 1.25 KB

Versions: 4

Compression:

Stored size: 1.25 KB

Contents

class TestWriter

  attr_accessor :styles, :worksheets, :columns, :rows, :cells

  def initialize
    @styles = []
    @worksheets = []
    @columns = []
    @rows = []
    @cells = []
  end

  def bind(workbook)
    workbook
  end

  def style(obj, &block)
    @styles << obj
    block.call if !block.nil?
  end

  def worksheet(obj, &block)
    @worksheets << obj
    block.call if !block.nil?
  end

  def column(obj, &block)
    @columns << obj
    block.call if !block.nil?
  end

  def row(obj, &block)
    @rows << obj
    block.call if !block.nil?
  end

  def cell(obj, &block)
    @cells << obj
    block.call if !block.nil?
  end

  def style(*args)
    return *args
  end

  [ :title,       # workbook_element
    :name,        # worksheet
    :meta,        # worksheet, column, row, cell
    :width,       # column
    :height,      # row
    :autofit,     # column, row
    :autofit?,    # column, row
    :hidden,      # column, row
    :hidden?,     # column, row
    :data,        # cell
    :href,        # cell
    :formula,     # cell
    :index,       # cell
    :rowspan,     # cell
    :colspan,     # cell
  ].each do |meth|
    define_method(meth) do |*args|
      # cool story bro (don't do anything, just allow)
      return args
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
osheet-1.1.1 test/support/test_writer.rb
osheet-1.1.0 test/support/test_writer.rb
osheet-1.0.0 test/support/test_writer.rb
osheet-1.0.0.rc.4 test/fixtures/test_writer.rb