Class: Spreadsheet::Writer
- Inherits:
-
Object
- Object
- Spreadsheet::Writer
- Defined in:
- lib/spreadsheet/writer.rb
Overview
Parent Class for all Writers. Implements the copying of unmodified Spreadsheet documents.
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(io_or_path) ⇒ Writer
constructor
A new instance of Writer.
- #write(workbook) ⇒ Object
Constructor Details
#initialize(io_or_path) ⇒ Writer
Returns a new instance of Writer.
6 7 8 |
# File 'lib/spreadsheet/writer.rb', line 6 def initialize io_or_path @io_or_path = io_or_path end |
Instance Method Details
#write(workbook) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/spreadsheet/writer.rb', line 9 def write workbook if @io_or_path.respond_to? :seek @io_or_path.binmode write_workbook workbook, @io_or_path else File.open(@io_or_path, "wb+") do |fh| write_workbook workbook, fh end end end |