Class: Farce::Unshared::Lazy
- Inherits:
-
Abstract::Lazy
- Object
- Abstract::Lazy
- Farce::Unshared::Lazy
- Includes:
- Farce::Unshareable
- Defined in:
- lib/farce/unshared/lazy.rb,
lib/farce/unshared/lazy.rb
Overview
A thread-safe lazy value within one Ractor. Its factory may capture mutable state. The result retains its identity. Factory failures can be retried on the next access.
Instance Method Summary collapse
-
#initialize ⇒ Lazy
constructor
Without
self:, the block keeps its original receiver.
Methods included from Farce::Unshareable
Methods inherited from Abstract::Lazy
Methods included from Abstract::Value
Methods included from Internal::Copyable
Constructor Details
#initialize(factory) ⇒ Lazy #initialize(self: nil) { ... } ⇒ Lazy
Without self:, the block keeps its original receiver.
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/farce/unshared/lazy.rb', line 26 class Lazy < Abstract::Lazy include Unshareable private def new_internal_atom = Internal::UnsharedAtom.new def prepare_proc(factory, **) .empty? ? factory : Farce.rebind(factory, **) end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Farce::Abstract::Lazy