Class: DRb::DRbUnknown
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/drb/drb.rb |
Overview
Class wrapping a marshalled object whose type is unknown locally.
If an object is returned by a method invoked over drb, but the class of the object is unknown in the client namespace, or the object is a constant unknown in the client namespace, then the still-marshalled object is returned wrapped in a DRbUnknown
instance.
If this object is passed as an argument to a method invoked over drb, then the wrapped object is passed instead.
The class or constant name of the object can be read from the #name attribute. The marshalled object is held in the #buf attribute.
Class Method Summary
-
.new(err, buf) ⇒ DRbUnknown
constructor
Create a new
DRbUnknown
object. - ._load(s) Internal use only
Instance Attribute Summary
Instance Method Summary
-
#exception
Create a
DRbUnknownError
exception containing this object. -
#reload
Attempt to load the wrapped marshalled object again.
- #_dump(lv) Internal use only
Constructor Details
.new(err, buf) ⇒ DRbUnknown
Create a new DRbUnknown
object.
#buf is a string containing a marshalled object that could not be unmarshalled. err
is the error message that was raised when the unmarshalling failed. It is used to determine the name of the unmarshalled object.
Class Method Details
._load(s)
# File 'lib/drb/drb.rb', line 485
def self._load(s) # :nodoc: begin Marshal::load(s) rescue NameError, ArgumentError DRbUnknown.new($!, s) end end
Instance Attribute Details
#buf (readonly)
Buffer contained the marshalled, unknown object.
# File 'lib/drb/drb.rb', line 483
attr_reader :buf
#name (readonly)
The name of the unknown thing.
Class name for unknown objects; variable name for unknown constants.
# File 'lib/drb/drb.rb', line 480
attr_reader :name
Instance Method Details
#_dump(lv)
# File 'lib/drb/drb.rb', line 493
def _dump(lv) # :nodoc: @buf end
#exception
Create a DRbUnknownError
exception containing this object.
# File 'lib/drb/drb.rb', line 507
def exception DRbUnknownError.new(self) end
#reload
Attempt to load the wrapped marshalled object again.
If the class of the object is now known locally, the object will be unmarshalled and returned. Otherwise, a new but identical DRbUnknown
object will be returned.
# File 'lib/drb/drb.rb', line 502
def reload self.class._load(@buf) end