Sha256: 7290fe8d3e13e673abeb2ff44cc2351c341bf780dc5ce984f1f8c02de254b8be
Contents?: true
Size: 604 Bytes
Versions: 4
Compression:
Stored size: 604 Bytes
Contents
module Metacrunch class Db::Reader def initialize(database_connection_or_url, dataset_proc, options = {}) @rows_per_fetch = options.delete(:rows_per_fetch) || 1000 @db = if database_connection_or_url.is_a?(String) Sequel.connect(database_connection_or_url, options) else database_connection_or_url end @dataset = dataset_proc.call(@db) end def each(&block) return enum_for(__method__) unless block_given? @dataset.paged_each(rows_per_fetch: @rows_per_fetch) do |row| yield(row) end self end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
metacrunch-3.0.3 | lib/metacrunch/db/reader.rb |
metacrunch-3.0.2 | lib/metacrunch/db/reader.rb |
metacrunch-3.0.1 | lib/metacrunch/db/reader.rb |
metacrunch-3.0.0 | lib/metacrunch/db/reader.rb |