Method: Beaker::Command#initialize
- Defined in:
- lib/beaker/command.rb
#initialize(command, args = [], options = {}) ⇒ Command
Note:
For backwards compatability we must support any number of strings or symbols (or arrays of strings an symbols) and essentially ensure they are in a flattened array, coerced to strings, and call #join(‘ ’) on it. We have options for the command line invocation that must be turned into ‘–key=value’ and similarly joined as well as a hash of environment key value pairs, and finally we need a hash of options to control the default envs that are included.
Returns a new instance of Command.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/beaker/command.rb', line 47 def initialize command, args = [], = {} @command = command = @args = args @environment = {} @cmdexe = .delete(:cmdexe) || false @prepend_cmds = .delete(:prepend_cmds) || nil # this is deprecated and will not allow you to use a command line # option of `--environment`, please use ENV instead. [:ENV, :environment, 'environment', 'ENV'].each do |k| if [k].is_a?(Hash) @environment = @environment.merge(.delete(k)) end end end |