Sha256: 9c92f516df7bf5ca719970beb4f57f280bf363eaef13b2f73e28f12fe0a082ad

Contents?: true

Size: 454 Bytes

Versions: 1

Compression:

Stored size: 454 Bytes

Contents

class BatchLoader
  class Executor
    NAMESPACE = :batch_loader

    def self.ensure_current
      Thread.current[NAMESPACE] ||= new
    end

    def self.delete_current
      Thread.current[NAMESPACE] = nil
    end

    attr_reader :items_by_block, :loaded_values_by_block

    def initialize
      @items_by_block = Hash.new { |hash, key| hash[key] = Set.new }
      @loaded_values_by_block = Hash.new { |hash, key| hash[key] = {} }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
batch-loader-0.2.0 lib/batch_loader/executor.rb