# frozen_string_literal: false
# DRb.start_service(nil, nil, {:idconv => DRb::WeakIdConv.new})
class WeakIdConv < DRbIdConv
@map = ObjectSpace::WeakMap.new
@immutable[obj.__id__] = obj
return key if key.__id__ == ref
raise RangeError.new("invalid reference")
def to_obj(ref) # :nodoc:
return @weak_set.add(obj)
# DRb.install_id_conv(WeakIdConv.new)