Sha256: 542d591a7837f3b9b835dd3c248c9be558f41a0ef389e979ec9f4206b227c073
Contents?: true
Size: 974 Bytes
Versions: 3
Compression:
Stored size: 974 Bytes
Contents
# frozen_string_literal: true require 'drb' Class.include UU::Remotable module DRb class DRbObject alias __orig_method_missing method_missing def method_missing(*args, &blk) # rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing __orig_method_missing(*args, &blk) rescue DRb::DRbConnError, Errno::ECONNREFUSED sleep 0.1 retry end end end module UU class RemoteHelper def initialize @mutex = Mutex.new @count = 0 end attr_reader :count def disable @mutex.synchronize do @count += 1 GC.disable end end def enable @mutex.synchronize do @count -= 1 break unless @count <= 0 GC.enable end end def reset @mutex.synchronize do @count = 0 GC.enable end end def eval_(code) instance_eval(code) end def klass(name) eval_(name.to_s) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
uu-0.2.2 | lib/drb/http0helper.rb |
uu-0.2.1 | lib/drb/http0helper.rb |
uu-0.2.0 | lib/drb/http0helper.rb |