Class: DRb::WeakIdConv

Inherits:
DRbIdConv show all
Defined in:
lib/drb/weakidconv.rb

Overview

To use WeakIdConv:

DRb.start_service(nil, nil, {:idconv => DRb::WeakIdConv.new})

Defined Under Namespace

Classes: WeakSet

Instance Method Summary collapse

Constructor Details

#initializeWeakIdConv

Returns a new instance of WeakIdConv.



43
44
45
46
# File 'lib/drb/weakidconv.rb', line 43

def initialize()
  super()
  @weak_set = WeakSet.new
end

Instance Method Details

#to_id(obj) ⇒ Object

:nodoc:



53
54
55
# File 'lib/drb/weakidconv.rb', line 53

def to_id(obj) # :nodoc:
  return @weak_set.add(obj)
end

#to_obj(ref) ⇒ Object

:nodoc:



48
49
50
51
# File 'lib/drb/weakidconv.rb', line 48

def to_obj(ref) # :nodoc:
  return super if ref.nil?
  @weak_set.fetch(ref)
end