Sha256: 54807cc395e1489d2e385582a95a6771606786e639eba500dbb865aaf5f82ded

Contents?: true

Size: 521 Bytes

Versions: 2

Compression:

Stored size: 521 Bytes

Contents

require 'upsert/buffer/mysql2_client'
require 'upsert/buffer/pg_connection'
require 'upsert/buffer/sqlite3_database'

class Upsert
  # @private
  class Buffer
    attr_reader :parent
    attr_reader :rows

    def initialize(parent)
      @parent = parent
      @rows = []
    end

    def <<(row)
      rows << row
      ready
    end

    def async?
      !!@async
    end

    def async!
      @async = true
    end

    def sync!
      @async = false
      until rows.empty?
        ready
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
upsert-0.5.0 lib/upsert/buffer.rb
upsert-0.4.0 lib/upsert/buffer.rb