Class: Proclib::Invocation

Inherits:
Object
  • Object
show all
Defined in:
lib/proclib/invocation.rb

Constant Summary collapse

Invalid =
Class.new(Error)

Instance Method Summary collapse

Constructor Details

#initialize(cmd, tag: nil, env: {}, cwd: nil, stdin: nil, ssh: nil) ⇒ Invocation

Returns a new instance of Invocation.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/proclib/invocation.rb', line 14

def initialize(cmd,
  tag: nil,
  env: {},
  cwd: nil,
  stdin: nil,
  ssh: nil
)
  @cmd = cmd
  @tag = tag
  @env = env
  @cwd = cwd
  @ssh = ssh
  @stdin = stdin
end

Instance Method Details

#commandsObject



29
30
31
32
33
34
35
36
37
# File 'lib/proclib/invocation.rb', line 29

def commands
  if validated_cmd.is_a?(String)
    [ make_command(validated_cmd) ]
  else
    validated_cmd.map do |tag, cmdline|
      make_command(cmdline, tag: tag)
    end
  end
end