End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
Ractor.shareable?
Ractor.shareable?(obj) → true | false
ractor.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/ractor.rb, line 769
def self.shareable? obj
__builtin_cexpr! %q{
rb_ractor_shareable_p(obj) ? Qtrue : Qfalse;
}
end
Checks if the object is shareable by ractors.
Example
Ractor.shareable?(1) #=> true -- numbers and other immutable basic values are frozen Ractor.shareable?('foo') #=> false, unless the string is frozen due to # freeze_string_literals: true Ractor.shareable?('foo'.freeze) #=> true
See also the “Shareable and unshareable objects” section in the Ractor class docs.