class Tartarus::ArchiveStrategy::ExtractBatch
Attributes
config[R]
Public Class Methods
new(config: Thread.current)
click to toggle source
# File lib/tartarus/archive_strategy/extract_batch.rb, line 7 def initialize(config: Thread.current) @config = config end
Public Instance Methods
call(collection) { |in_batches| ... }
click to toggle source
# File lib/tartarus/archive_strategy/extract_batch.rb, line 11 def call(collection) if collection.respond_to?(:in_batches) && !suppressed_in_batches? yield collection.in_batches else primary_key = collection.primary_key collection.select(primary_key).find_in_batches do |group| yield collection.where(primary_key => group) end end end
suppressed_in_batches?()
click to toggle source
# File lib/tartarus/archive_strategy/extract_batch.rb, line 23 def suppressed_in_batches? !!config["__TARTARUS__SUPPRESSED_IN_BATCHES"] end