class Toys::Utils::Exec::Opts
An internal helper class storing the configuration of a subprocess invocation @private
Constants
- CONFIG_KEYS
Option keys that belong to exec configuration @private
- SPAWN_KEYS
Option keys that belong to spawn configuration @private
Attributes
config_opts[R]
@private
spawn_opts[R]
@private
Public Class Methods
new(parent = nil) { |k| ... }
click to toggle source
@private
# File lib/toys/utils/exec.rb, line 437 def initialize(parent = nil) if parent @config_opts = ::Hash.new { |_h, k| parent.config_opts[k] } @spawn_opts = ::Hash.new { |_h, k| parent.spawn_opts[k] } elsif block_given? @config_opts = ::Hash.new { |_h, k| yield k } @spawn_opts = ::Hash.new { |_h, k| yield k } else @config_opts = {} @spawn_opts = {} end end
Public Instance Methods
add(config)
click to toggle source
@private
# File lib/toys/utils/exec.rb, line 451 def add(config) config.each do |k, v| if CONFIG_KEYS.include?(k) @config_opts[k] = v elsif SPAWN_KEYS.include?(k) || k.to_s.start_with?("rlimit_") @spawn_opts[k] = v else raise ::ArgumentError, "Unknown key: #{k.inspect}" end end self end
delete(*keys)
click to toggle source
@private
# File lib/toys/utils/exec.rb, line 465 def delete(*keys) keys.each do |k| if CONFIG_KEYS.include?(k) @config_opts.delete(k) elsif SPAWN_KEYS.include?(k) || k.to_s.start_with?("rlimit_") @spawn_opts.delete(k) else raise ::ArgumentError, "Unknown key: #{k.inspect}" end end self end