Class: Tabula::Writers::Writer
- Inherits:
-
Object
- Object
- Tabula::Writers::Writer
- Defined in:
- lib/tabula/writers/writer.rb
Overview
Base class for table output writers
Direct Known Subclasses
Class Method Summary collapse
-
.to_string(tables, **options) ⇒ String
Write tables to a string.
-
.write(tables, io = $stdout, **options) ⇒ Object
Write tables to an IO object.
Instance Method Summary collapse
-
#initialize(**options) ⇒ Writer
constructor
A new instance of Writer.
-
#write(tables, io) ⇒ Object
Write tables to an IO object.
Constructor Details
#initialize(**options) ⇒ Writer
Returns a new instance of Writer.
27 28 29 |
# File 'lib/tabula/writers/writer.rb', line 27 def initialize(**) @options = end |
Class Method Details
.to_string(tables, **options) ⇒ String
Write tables to a string
19 20 21 22 23 24 |
# File 'lib/tabula/writers/writer.rb', line 19 def self.to_string(tables, **) require 'stringio' io = StringIO.new write(tables, io, **) io.string end |
.write(tables, io = $stdout, **options) ⇒ Object
Write tables to an IO object
11 12 13 |
# File 'lib/tabula/writers/writer.rb', line 11 def self.write(tables, io = $stdout, **) new(**).write(tables, io) end |
Instance Method Details
#write(tables, io) ⇒ Object
Write tables to an IO object
34 35 36 |
# File 'lib/tabula/writers/writer.rb', line 34 def write(tables, io) raise NotImplementedError, 'Subclasses must implement #write' end |