123456789_123456789_123456789_123456789_123456789_

Class: DRb::GWIdConv

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

Overview

Gateway id conversion forms a gateway between different ::DRb protocols or networks.

The gateway needs to install this id conversion and create servers for each of the protocols or networks it will be a gateway between. It then needs to create a server that attaches to each of these networks. For example:

require 'drb/drb'
require 'drb/unix'
require 'drb/gw'

DRb.install_id_conv DRb::GWIdConv.new
gw = DRb::GW.new
s1 = DRb::DRbServer.new 'drbunix:/path/to/gateway', gw
s2 = DRb::DRbServer.new 'druby://example:10000', gw

s1.thread.join
s2.thread.join

Each client must register services with the gateway, for example:

DRb.start_service 'drbunix:', nil # an anonymous server
gw = DRbObject.new nil, 'drbunix:/path/to/gateway'
gw[:unix] = some_service
DRb.thread.join

Instance Method Summary

DRbIdConv - Inherited

#to_id

Convert an object into a reference id.

#to_obj

Convert an object reference id to an object.

Instance Method Details

#to_obj(ref)

This method is for internal use only.
[ GitHub ]

  
# File 'lib/drb/gw.rb', line 35

def to_obj(ref) # :nodoc:
  if Array === ref && ref[0] == :DRbObject
    return DRbObject.new_with(ref[1], ref[2])
  end
  super(ref)
end