Module: Conductor::Worker::RactorSupport

Defined in:
lib/conductor/worker/ractor_task_runner.rb

Overview

Helper module to check Ractor availability

Class Method Summary collapse

Class Method Details

.available?Boolean

Check if Ractors are available (Ruby 3.1+)

Returns:

  • (Boolean)


481
482
483
484
485
486
487
488
489
# File 'lib/conductor/worker/ractor_task_runner.rb', line 481

def available?
  return @available if defined?(@available)

  @available = begin
    RUBY_VERSION >= '3.1' && !defined?(Ractor).nil?
  rescue StandardError
    false
  end
end

.require_ractors!Object

Raise error if Ractors not available

Raises:



492
493
494
495
496
497
# File 'lib/conductor/worker/ractor_task_runner.rb', line 492

def require_ractors!
  return if available?

  raise ConfigurationError,
        "Ractors require Ruby 3.1 or later. Current version: #{RUBY_VERSION}"
end