123456789_123456789_123456789_123456789_123456789_

Class: DRb::WeakIdConv

Relationships & Source Files
Namespace Children
Classes:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, DRbIdConv
Instance Chain:
self, DRbIdConv
Inherits: DRb::DRbIdConv
Defined in: lib/drb/weakidconv.rb

Overview

To use WeakIdConv:

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

Class Method Summary

Instance Method Summary

DRbIdConv - Inherited

#to_id

Convert an object into a reference id.

#to_obj

Convert an object reference id to an object.

Constructor Details

.newWeakIdConv

[ GitHub ]

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

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

Instance Method Details

#to_id(obj)

This method is for internal use only.
[ GitHub ]

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

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

#to_obj(ref)

This method is for internal use only.
[ GitHub ]

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

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