Sha256: 8a773ca818062baf03c132b0e3528dcbed7822471b57bf193eb934032dceb635
Contents?: true
Size: 668 Bytes
Versions: 4
Compression:
Stored size: 668 Bytes
Contents
require "forwardable" require "thread" module Hamster # @private module ReadCopyUpdate extend Forwardable def initialize(content) @content = content @lock = Mutex.new end def eql?(other) instance_of?(other.class) && @content.eql?(other.instance_variable_get(:@content)) end alias :== :eql? def_delegator :@content, :inspect def_delegator :@content, :to_s protected def transform @lock.synchronize do @content = yield(@content) end self end private def method_missing(name, *args, &block) @content.send(name, *args, &block) rescue super end end end
Version data entries
4 entries across 4 versions & 2 rubygems