Module: Farce::Local::Scoped
- Includes:
- Shareable
- Included in:
- Lazy, Lease, LeaseMap, LeasePool, PriorityQueue, Queue, TimerQueue
- Defined in:
- lib/farce/local/scoped.rb,
lib/farce/integrations/active_support/map.rb
Overview
Common scope selection and storage for shareable local objects.
Instance Attribute Summary collapse
-
#scope ⇒ Symbol
readonly
The scope used to resolve this object's contents.
Instance Method Summary collapse
-
#initialize(*arguments, scope: :ractor, **options) ⇒ BasicObject
Constructor arguments configure each scope's independent backing object.
Methods included from Shareable
Instance Attribute Details
#scope ⇒ Symbol (readonly)
Returns The scope used to resolve this object's contents.
87 88 89 |
# File 'lib/farce/local/scoped.rb', line 87 def scope @scope end |
Instance Method Details
#initialize(*arguments, scope: :ractor, **options) ⇒ BasicObject
Constructor arguments configure each scope's independent backing object. Valid scopes are:
:ractor- The value is shared by all threads within the same Ractor.:thread_group- The value is shared by all threads within the same thread group.:thread- The value is shared by all fibers within the same thread.:fiber_storage- The value is shared by all fibers using the same storage. Unless explicitly specified, storage is inherited from the parent fiber for blocking fibers, but not for non-blocking fibers (such as those created by Scheduler#schedule).:fiber- Each fiber has its own independent value.
94 95 96 |
# File 'lib/farce/local/scoped.rb', line 94 def initialize(*arguments, scope: :ractor, **) initialize_scoped(arguments, , scope:) end |