Module: Conductor::Worker::AsyncSupport

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

Overview

Helper to check async gem availability

Class Method Summary collapse

Class Method Details

.available?Boolean

Returns:

  • (Boolean)


511
512
513
514
515
516
517
518
519
520
# File 'lib/conductor/worker/fiber_executor.rb', line 511

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

  @available = begin
    require 'async'
    true
  rescue LoadError
    false
  end
end

.require_async!Object

Raises:



522
523
524
525
526
527
528
# File 'lib/conductor/worker/fiber_executor.rb', line 522

def require_async!
  return if available?

  raise ConfigurationError,
        "The 'async' gem is required for fiber executor. " \
        "Add `gem 'async'` to your Gemfile."
end