Sha256: b0b0437e276b8b9ad85b48cc728945745af38a5a5b0c84d2eb66b9f24e214398

Contents?: true

Size: 647 Bytes

Versions: 8

Compression:

Stored size: 647 Bytes

Contents

module Spreadsheet
  ##
  # Parent Class for all Writers. Implements the copying of unmodified
  # Spreadsheet documents.
  class Writer
    def initialize io_or_path
      @io_or_path = io_or_path
    end
    def write workbook
      if @io_or_path.is_a? IO
        write_workbook workbook, @io_or_path
      else
        File.open(@io_or_path, "wb+") do |fh|
          write_workbook workbook, fh
        end
      end
    end
    private
    def write_workbook workbook, io
      reader = workbook.io
      unless io == reader
        reader.rewind
        data = reader.read
        io.rewind
        io.write data
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
spreadsheet-0.6.1.3 lib/spreadsheet/writer.rb
spreadsheet-0.6.0 lib/spreadsheet/writer.rb
spreadsheet-0.6.1.1 lib/spreadsheet/writer.rb
spreadsheet-0.6.1.2 lib/spreadsheet/writer.rb
spreadsheet-0.6.1.5 lib/spreadsheet/writer.rb
spreadsheet-0.6.1.6 lib/spreadsheet/writer.rb
spreadsheet-0.6.1.4 lib/spreadsheet/writer.rb
spreadsheet-0.6.1 lib/spreadsheet/writer.rb