Class: CanvasSync::Importers::BulkImporter::RowBuffer
- Inherits:
-
Object
- Object
- CanvasSync::Importers::BulkImporter::RowBuffer
- Defined in:
- lib/canvas_sync/importers/bulk_importer.rb
Direct Known Subclasses
Instance Method Summary collapse
- #<<(v) ⇒ Object
- #flush(value = @buffered_rows) ⇒ Object
-
#initialize(&block) ⇒ RowBuffer
constructor
A new instance of RowBuffer.
Constructor Details
#initialize(&block) ⇒ RowBuffer
Returns a new instance of RowBuffer.
149 150 151 152 |
# File 'lib/canvas_sync/importers/bulk_importer.rb', line 149 def initialize(&block) @flush_out = block @buffered_rows = [] end |
Instance Method Details
#<<(v) ⇒ Object
154 155 156 |
# File 'lib/canvas_sync/importers/bulk_importer.rb', line 154 def <<(v) @buffered_rows << v end |
#flush(value = @buffered_rows) ⇒ Object
158 159 160 161 162 163 164 165 166 167 |
# File 'lib/canvas_sync/importers/bulk_importer.rb', line 158 def flush(value = @buffered_rows) if value.is_a?(Array) value.each do |v| @flush_out.call(v) end else @flush_out.call(value) end @buffered_rows = [] end |