Sha256: 384766e2354c9873c69e8e43359843f99f4e7fcec948a5366e1ead4f4f86417b

Contents?: true

Size: 394 Bytes

Versions: 6

Compression:

Stored size: 394 Bytes

Contents

module Cubism
  class CubicleBlockStore
    include Singleton

    def initialize
      @blocks = {}
    end

    def [](key)
      @blocks[key]
    end

    def []=(key, value)
      mutex.synchronize do
        @blocks[key] = value
      end
    end

    private

    def mutex
      @mutex ||= Mutex.new
    end
  end

  BlockStoreItem = Struct.new(:context, :block, keyword_init: true)
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cubism-0.1.0.pre9 lib/cubism/cubicle_block_store.rb~
cubism-0.1.0.pre8 lib/cubism/cubicle_block_store.rb
cubism-0.1.0.pre7 lib/cubism/cubicle_block_store.rb
cubism-0.1.0.pre6 lib/cubism/cubicle_block_store.rb
cubism-0.1.0.pre5 lib/cubism/cubicle_block_store.rb
cubism-0.1.0.pre4 lib/cubism/cubicle_block_store.rb