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.
158 159 160 161 |
# File 'lib/canvas_sync/importers/bulk_importer.rb', line 158 def initialize(&block) @flush_out = block @buffered_rows = [] end |
Instance Method Details
#<<(v) ⇒ Object
163 164 165 |
# File 'lib/canvas_sync/importers/bulk_importer.rb', line 163 def <<(v) @buffered_rows << v end |
#flush(value = @buffered_rows) ⇒ Object
167 168 169 170 171 172 173 174 175 176 |
# File 'lib/canvas_sync/importers/bulk_importer.rb', line 167 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 |