Sha256: 9caa71c52c136ff661cf61c86dfec7d3980c246266e4ba96ad1ae5fca1259f99

Contents?: true

Size: 437 Bytes

Versions: 4

Compression:

Stored size: 437 Bytes

Contents

require 'hamster/read_copy_update'
require 'hamster/hash'

module Hamster

  class ReadCopyUpdateHash

    include ReadCopyUpdate

    def initialize
      super(EmptyHash)
    end

    def put(key, value = Undefined)
      transform {
        get(key).tap { @content = @content.put(key, value) }
      }
    end

    def delete(key)
      transform {
        get(key).tap { @content = @content.delete(key) }
      }
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hamster-0.3.10 lib/hamster/read_copy_update_hash.rb
hamster-0.3.9 lib/hamster/read_copy_update_hash.rb
hamster-0.3.8 lib/hamster/read_copy_update_hash.rb
hamster-0.3.7 lib/hamster/read_copy_update_hash.rb