123456789_123456789_123456789_123456789_123456789_

Module: ActiveSupport::Ractors

Do not use. This module is for internal use only.
Relationships & Source Files
Defined in: activesupport/lib/active_support/ractors.rb

Overview

Shims for Ractor shareability methods so framework code can call them unconditionally regardless of the Ruby version.

Class Method Summary

Class Method Details

.make_shareable(obj, copy: false)

Makes obj Ractor-shareable by delegating to Ractor.make_shareable.

The copy: option is forwarded unchanged. On Ruby versions without Ractor.make_shareable, this shim returns obj unchanged.

See additional method definition at line 13.

[ GitHub ]

  
# File 'activesupport/lib/active_support/ractors.rb', line 45

def make_shareable(...)
  Ractor.make_shareable(...)
end

.shareable?(obj) ⇒ Boolean

Returns whether obj is Ractor-shareable by delegating to Ractor.shareable?.

On Ruby versions without Ractor.shareable?, this shim returns obj unchanged.

See additional method definition at line 22.

[ GitHub ]

  
# File 'activesupport/lib/active_support/ractors.rb', line 49

def shareable?(obj)
  Ractor.shareable?(obj)
end

.shareable_lambda(self: nil, &block)

Returns a Ractor-shareable lambda by delegating to Ractor.shareable_lambda.

The optional self: value is forwarded as the lambda's receiver. On Ruby versions without Ractor.shareable_lambda, this shim returns the block unchanged.

See additional method definition at line 41.

[ GitHub ]

  
# File 'activesupport/lib/active_support/ractors.rb', line 57

def shareable_lambda(...)
  Ractor.shareable_lambda(...)
end

.shareable_proc(self: nil, &block)

Returns a Ractor-shareable proc by delegating to Ractor.shareable_proc.

The optional self: value is forwarded as the proc's receiver. On Ruby versions without Ractor.shareable_proc, this shim returns the block unchanged.

See additional method definition at line 31.

[ GitHub ]

  
# File 'activesupport/lib/active_support/ractors.rb', line 53

def shareable_proc(...)
  Ractor.shareable_proc(...)
end