123456789_123456789_123456789_123456789_123456789_

Module: ActiveSupport::Testing::RactorsAssertions

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

Instance Method Summary

Instance Method Details

#assert_ractor_make_shareable(obj) (private)

See additional method definition at line 20.

[ GitHub ]

  
# File 'activesupport/lib/active_support/testing/ractors_assertions.rb', line 32

def assert_ractor_make_shareable(obj)
  assert_nothing_raised { Ractor.make_shareable(obj) }
end

#assert_ractor_shareable(obj) (private)

See additional method definition at line 24.

[ GitHub ]

  
# File 'activesupport/lib/active_support/testing/ractors_assertions.rb', line 36

def assert_ractor_shareable(obj)
  assert Ractor.shareable?(obj), "Expected #{obj.inspect} to be shareable, but it is not."
end

#on_ractor(*args) {|args| ... } (private)

See additional method definition at line 8.

Yields:

  • (args)
[ GitHub ]

  
# File 'activesupport/lib/active_support/testing/ractors_assertions.rb', line 28

def on_ractor(*args, &block)
  block = Ractor.shareable_proc(&block)

  port = Ractor::Port.new

  Ractor.new(port, block, args) do |port, block, args|
    port.send block.call(*args)
  end.join

  port.receive
end