Module: Concurrent::OptionsParser
Overview
A mixin module for parsing options hashes related to gem-level configuration.
Instance Method Summary collapse
-
#get_executor_from(opts = {}) ⇒ Executor?
Get the requested ‘Executor` based on the values set in the options hash.
-
#get_operation_executor_from(opts = {}) ⇒ Executor
Get the requested ‘Executor` based on the values set in the options hash.
-
#get_task_executor_from(opts = {}) ⇒ Executor
Get the requested ‘Executor` based on the values set in the options hash.
Instance Method Details
#get_executor_from(opts = {}) ⇒ Executor?
Get the requested ‘Executor` based on the values set in the options hash.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/concurrent/options_parser.rb', line 14 def get_executor_from(opts = {}) if opts[:executor] opts[:executor] elsif opts[:operation] == true || opts[:task] == false Concurrent.configuration.global_operation_pool elsif opts[:operation] == false || opts[:task] == true Concurrent.configuration.global_task_pool else nil end end |
#get_operation_executor_from(opts = {}) ⇒ Executor
Get the requested ‘Executor` based on the values set in the options hash.
42 43 44 |
# File 'lib/concurrent/options_parser.rb', line 42 def get_operation_executor_from(opts = {}) opts[:operation_executor] || opts[:executor] || Concurrent.configuration.global_operation_pool end |
#get_task_executor_from(opts = {}) ⇒ Executor
Get the requested ‘Executor` based on the values set in the options hash.
32 33 34 |
# File 'lib/concurrent/options_parser.rb', line 32 def get_task_executor_from(opts = {}) opts[:task_executor] || opts[:executor] || Concurrent.configuration.global_task_pool end |