module Concurrent::Options

def self.executor(executor_identifier)

def self.executor(executor_identifier)
  case executor_identifier
  when :fast
    Concurrent.global_fast_executor
  when :io
    Concurrent.global_io_executor
  when :immediate
    Concurrent.global_immediate_executor
  when Concurrent::ExecutorService
    executor_identifier
  else
    raise ArgumentError, "executor not recognized by '#{executor_identifier}'"
  end
end

def self.executor_from_options(opts = {}) # :nodoc:

Returns:
  • (Executor, nil) - the requested thread pool, or nil when no option specified

Options Hash: (**opts)
  • :executor (Executor) -- when set use the given `Executor` instance.

Parameters:
  • opts (Hash) -- the options defining the requested executor
def self.executor_from_options(opts = {}) # :nodoc:
  if identifier = opts.fetch(:executor, nil)
    executor(identifier)
  else
    nil
  end
end