Class: Farce::Envelope::Marshal
- Inherits:
-
Farce::Envelope
- Object
- Farce::Envelope
- Farce::Envelope::Marshal
- Defined in:
- lib/farce/envelope.rb
Overview
An envelope that serializes its contents with Ruby's Marshal protocol. The snapshot is created immediately and reconstructed once per Ractor that opens it. Farce containers rebuild their storage from logical snapshots. Contents must support Marshal. Nested shareable values may be reconstructed too.
Constant Summary
Constants inherited from Farce::Envelope
Instance Method Summary collapse
-
#claim ⇒ Envelope?
Attempts to claim the envelope for the current Ractor.
-
#claimed? ⇒ Boolean
trueif the envelope has been claimed by any Ractor,falseotherwise. -
#initialize(value, auto_unwrap = nil) ⇒ Marshal
constructor
A new instance of Marshal.
-
#owned? ⇒ Boolean
trueif the envelope has been claimed by the current Ractor,falseotherwise.
Methods included from Internal::Copyable
Methods inherited from Farce::Envelope
#blank?, #claim!, new, #same_value?, #value
Methods included from Abstract::Value
Methods included from Shareable
Methods included from Internal::Noncopyable
Constructor Details
#initialize(value, auto_unwrap = nil) ⇒ Marshal
Returns a new instance of Marshal.
129 130 131 132 |
# File 'lib/farce/envelope.rb', line 129 def initialize(value, auto_unwrap = nil) @dump = ::Marshal.dump(value).freeze super end |
Instance Method Details
#claim ⇒ Envelope?
Attempts to claim the envelope for the current Ractor.
145 |
# File 'lib/farce/envelope.rb', line 145 def claim = self |
#claimed? ⇒ Boolean
Returns true if the envelope has been claimed by any Ractor, false otherwise.
148 |
# File 'lib/farce/envelope.rb', line 148 def claimed? = true |
#owned? ⇒ Boolean
Returns true if the envelope has been claimed by the current Ractor, false otherwise.
151 |
# File 'lib/farce/envelope.rb', line 151 def owned? = true |