Module: ActiveSupport::Ractors
| Relationships & Source Files | |
| Namespace Children | |
|
Classes:
| |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
Autoload
|
|
| Defined in: | activesupport/lib/active_support/ractors.rb, activesupport/lib/active_support/ractors/logger.rb, activesupport/lib/active_support/ractors/logger/device_proxy.rb, activesupport/lib/active_support/ractors/logger/writer.rb |
Overview
Shims for Ractor shareability methods so framework code can call them
unconditionally regardless of the Ruby version.
Class Attribute Summary
-
.main?
readonly
See additional method definition at line 81.
- .unshareable_proc_action rw
Class Method Summary
-
.make_shareable(obj, copy: false)
Makes
objRactor-shareable by delegating toRactor.make_shareable. -
.on_main(obj = nil, &block)
See additional method definition at line 71.
-
.shareable?(obj) ⇒ Boolean
Returns whether
objis Ractor-shareable by delegating toRactor.shareable?. -
.shareable_lambda(self: nil, &block)
Returns a Ractor-shareable lambda by delegating to
Ractor.shareable_lambda. -
.shareable_proc(self: nil, &block)
Returns a Ractor-shareable proc by delegating to
Ractor.shareable_proc. -
.store_if_absent(key, &block)
Returns the value stored under
keyin the current Ractor's local storage, runningblockto compute and store it on first access, by delegating toRactor.store_if_absent. -
.try_make_shareable(obj)
Attempt to make an object shareable.
-
.try_shareable_proc(proc = nil, &block)
Attempt to make a proc shareable.
Autoload - Extended
Class Attribute Details
.main? (readonly)
See additional method definition at line 81.
# File 'activesupport/lib/active_support/ractors.rb', line 122
def main? Ractor.main? end
Class Method Details
.on_main(obj = nil, &block)
See additional method definition at line 71.
# File 'activesupport/lib/active_support/ractors.rb', line 126
def on_main(obj = nil, &block) if Ractor.main? obj.instance_eval(&block) else require "ractor/dispatch" shareable_block = Ractor.shareable_proc(&block) Ractor::Dispatch.main.run { obj.instance_eval(&shareable_block) } end end
.store_if_absent(key, &block)
Returns the value stored under key in the current Ractor's local
storage, running block to compute and store it on first access, by
delegating to Ractor.store_if_absent. Concurrent threads in the
same Ractor initialize the value only once.
See additional method definition at line 153.
# File 'activesupport/lib/active_support/ractors.rb', line 163
def self.store_if_absent(key, &block) Ractor.store_if_absent(key, &block) end