Class: ProcessExecuter::Options
- Inherits:
-
Object
- Object
- ProcessExecuter::Options
- Defined in:
- lib/process_executer/options.rb
Overview
Validate ProcessExecuter::Executer#spawn options and return Process.spawn options
Valid options are those accepted by Process.spawn plus the following additions:
:timeout
:
Constant Summary collapse
- SPAWN_OPTIONS =
These options should be passed to
Process.spawn
Additionally, any options whose key is an Integer or an IO object will be passed to
Process.spawn
. %i[ in out err unsetenv_others pgroup new_pgroup rlimit_resourcename umask close_others chdir ].freeze
- NON_SPAWN_OPTIONS =
These options are allowed by
ProcessExecuter.spawn
but should NOT be passed toProcess.spawn
%i[ timeout ].freeze
- NOT_SET =
Any
SPAWN_OPTIONS
set toNOT_SET
will not be passed toProcess.spawn
:not_set
- DEFAULTS =
The default values for all options
{ in: NOT_SET, out: NOT_SET, err: NOT_SET, unsetenv_others: NOT_SET, pgroup: NOT_SET, new_pgroup: NOT_SET, rlimit_resourcename: NOT_SET, umask: NOT_SET, close_others: NOT_SET, chdir: NOT_SET, timeout: nil }.freeze
- ALL_OPTIONS =
All options allowed by this class
(SPAWN_OPTIONS + NON_SPAWN_OPTIONS).freeze
Instance Method Summary collapse
-
#initialize(**options) ⇒ Options
constructor
Create a new Options object.
-
#spawn_options ⇒ Hash
Returns the options to be passed to Process.spawn.
Constructor Details
Instance Method Details
#spawn_options ⇒ Hash
Returns the options to be passed to Process.spawn
100 101 102 103 104 105 106 |
# File 'lib/process_executer/options.rb', line 100 def {}.tap do || .each do |option, value| [option] = value if include_spawn_option?(option, value) end end end |