module Concurrent::Options

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/concurrent-ruby/concurrent/options.rbs

module Concurrent::Options
  def self.executor: (Symbol executor_identifier) -> Concurrent::FixedThreadPool
  def self.executor_from_options: (?Hash opts) -> untyped
end

def self.executor(executor_identifier)

Experimental RBS support (using type sampling data from the type_fusion project).

def self.executor: (Symbol executor_identifier) -> Concurrent::FixedThreadPool

This signature was generated using 1 sample from 1 application.

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:

Experimental RBS support (using type sampling data from the type_fusion project).

def self.executor_from_options: (?executor | Symbol | __promise_body_from_block__ | Proc opts) -> untyped

This signature was generated using 1 sample from 1 application.

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