module DRb::DRbProtocol
def add_protocol(prot)
def add_protocol(prot) @protocol.push(prot) end
def auto_load(uri) # :nodoc:
def auto_load(uri) # :nodoc: if /\Adrb([a-z0-9]+):/ =~ uri require("drb/#{$1}") rescue nil end end
def open(uri, config, first=true)
URI, then a DRbBadURI error is raised. If a protocol accepts the
URI by raising a DRbBadScheme error. If no protocol recognises the
try to open the URI. Each protocol signals that it does not handle that
The DRbProtocol module asks each registered protocol in turn to
Open a client connection to +uri+ with the configuration +config+.
def open(uri, config, first=true) @protocol.each do |prot| begin return prot.open(uri, config) rescue DRbBadScheme rescue DRbConnError raise($!) rescue raise(DRbConnError, "#{uri} - #{$!.inspect}") end end if first && (config[:auto_load] != false) auto_load(uri) return open(uri, config, false) end raise DRbBadURI, 'can\'t parse uri:' + uri end
def open_server(uri, config, first=true)
accepts the URI, but an error occurs in opening it, the underlying
recognises the URI, then a DRbBadURI error is raised. If a protocol
not handle that URI by raising a DRbBadScheme error. If no protocol
try to open a server at the URI. Each protocol signals that it does
The DRbProtocol module asks each registered protocol in turn to
configuration +config+.
Open a server listening for connections at +uri+ with
def open_server(uri, config, first=true) @protocol.each do |prot| begin return prot.open_server(uri, config) rescue DRbBadScheme end end if first && (config[:auto_load] != false) auto_load(uri) return open_server(uri, config, false) end raise DRbBadURI, 'can\'t parse uri:' + uri end
def uri_option(uri, config, first=true)
URI by raising a DRbBadScheme error. If no protocol recognises the
try to parse the URI. Each protocol signals that it does not handle that
The DRbProtocol module asks each registered protocol in turn to
Parse +uri+ into a [uri, option] pair.
def uri_option(uri, config, first=true) @protocol.each do |prot| begin uri, opt = prot.uri_option(uri, config) # opt = nil if opt == '' return uri, opt rescue DRbBadScheme end end if first && (config[:auto_load] != false) auto_load(uri) return uri_option(uri, config, false) end raise DRbBadURI, 'can\'t parse uri:' + uri end