Class: Dizby::UnknownObject
- Inherits:
-
Object
- Object
- Dizby::UnknownObject
- Defined in:
- lib/dizby/distributed/unknown.rb
Instance Attribute Summary collapse
-
#buf
readonly
Returns the value of attribute buf.
-
#name
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #_dump(_)
- #exception
-
#initialize(err, buf) ⇒ UnknownObject
constructor
A new instance of UnknownObject.
- #reload
Constructor Details
#initialize(err, buf) ⇒ UnknownObject
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/dizby/distributed/unknown.rb', line 12 def initialize(err, buf) @name = case err.to_s when /uninitialized constant (\S+)/ $~[1] when %r{undefined class/module (\S+)} $~[1] end @buf = buf end |
Instance Attribute Details
#buf (readonly)
Returns the value of attribute buf.
24 25 26 |
# File 'lib/dizby/distributed/unknown.rb', line 24 def buf @buf end |
#name (readonly)
Returns the value of attribute name.
24 25 26 |
# File 'lib/dizby/distributed/unknown.rb', line 24 def name @name end |
Class Method Details
._load(str)
26 27 28 29 30 |
# File 'lib/dizby/distributed/unknown.rb', line 26 def self._load(str) Marshal.load(str) rescue NameError, ArgumentError UnknownObject.new($!, str) end |
Instance Method Details
#_dump(_)
32 33 34 |
# File 'lib/dizby/distributed/unknown.rb', line 32 def _dump(_) Marshal.dump(@buf) end |
#exception
40 41 42 |
# File 'lib/dizby/distributed/unknown.rb', line 40 def exception UnknownObjectError.new self end |
#reload
36 37 38 |
# File 'lib/dizby/distributed/unknown.rb', line 36 def reload self.class._load @buf end |