Object
wrapping a reference to a remote drb object.
Method
calls on this object are relayed to the remote object that this object is a stub for.
Methods
- #
- M
- N
- R
Class Public methods
_load(s) Link
new(obj, uri=nil) Link
Create a new remote object stub.
obj
is the (local) object we want to create a stub for. Normally this is nil
. uri
is the URI
of the remote object that this will be a stub for.
# File ruby/lib/drb/drb.rb, line 1089 def initialize(obj, uri=nil) @uri = nil @ref = nil case obj when Object is_nil = obj.nil? when BasicObject is_nil = false end if is_nil return if uri.nil? @uri, option = DRbProtocol.uri_option(uri, DRb.config) @ref = DRbURIOption.new(option) unless option.nil? else @uri = uri ? uri : (DRb.uri rescue nil) @ref = obj ? DRb.to_id(obj) : nil end end
new_with(uri, ref) Link
Creates a DRb::DRbObject
given the reference information to the remote host uri
and object ref
.
new_with_uri(uri) Link
Instance Public methods
__drbref() Link
Get the reference of the object, if local.
method_missing(msg_id, *a, &b) Link
# File ruby/lib/drb/drb.rb, line 1135 def method_missing(msg_id, *a, &b) if DRb.here?(@uri) obj = DRb.to_obj(@ref) DRb.current_server.check_insecure_method(obj, msg_id) return obj.__send__(msg_id, *a, &b) end succ, result = self.class.with_friend(@uri) do DRbConn.open(@uri) do |conn| conn.send_message(self, msg_id, a, b) end end if succ return result elsif DRbUnknown === result raise result else bt = self.class.prepare_backtrace(@uri, result) result.set_backtrace(bt + caller) raise result end end