Class: JetBlack::ExecutedCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/jet_black/executed_command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_command:, stdout:, stderr:, exit_status:) ⇒ ExecutedCommand

Returns a new instance of ExecutedCommand.



10
11
12
13
14
15
16
17
# File 'lib/jet_black/executed_command.rb', line 10

def initialize(raw_command:, stdout:, stderr:, exit_status:)
  @raw_command = raw_command
  @raw_stdout = stdout
  @raw_stderr = stderr
  @stdout = scrub(stdout)
  @stderr = scrub(stderr)
  @exit_status = exit_status.to_i
end

Instance Attribute Details

#exit_statusObject (readonly)

Returns the value of attribute exit_status.



7
8
9
# File 'lib/jet_black/executed_command.rb', line 7

def exit_status
  @exit_status
end

#raw_commandObject (readonly)

Returns the value of attribute raw_command.



7
8
9
# File 'lib/jet_black/executed_command.rb', line 7

def raw_command
  @raw_command
end

#raw_stderrObject (readonly)

Returns the value of attribute raw_stderr.



7
8
9
# File 'lib/jet_black/executed_command.rb', line 7

def raw_stderr
  @raw_stderr
end

#raw_stdoutObject (readonly)

Returns the value of attribute raw_stdout.



7
8
9
# File 'lib/jet_black/executed_command.rb', line 7

def raw_stdout
  @raw_stdout
end

#stderrObject (readonly)

Returns the value of attribute stderr.



7
8
9
# File 'lib/jet_black/executed_command.rb', line 7

def stderr
  @stderr
end

#stdoutObject (readonly)

Returns the value of attribute stdout.



7
8
9
# File 'lib/jet_black/executed_command.rb', line 7

def stdout
  @stdout
end

Instance Method Details

#failure?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/jet_black/executed_command.rb', line 23

def failure?
  !success?
end

#success?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/jet_black/executed_command.rb', line 19

def success?
  exit_status.zero?
end