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.



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

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.



5
6
7
# File 'lib/jet_black/executed_command.rb', line 5

def exit_status
  @exit_status
end

#raw_commandObject (readonly)

Returns the value of attribute raw_command.



5
6
7
# File 'lib/jet_black/executed_command.rb', line 5

def raw_command
  @raw_command
end

#raw_stderrObject (readonly)

Returns the value of attribute raw_stderr.



5
6
7
# File 'lib/jet_black/executed_command.rb', line 5

def raw_stderr
  @raw_stderr
end

#raw_stdoutObject (readonly)

Returns the value of attribute raw_stdout.



5
6
7
# File 'lib/jet_black/executed_command.rb', line 5

def raw_stdout
  @raw_stdout
end

#stderrObject (readonly)

Returns the value of attribute stderr.



5
6
7
# File 'lib/jet_black/executed_command.rb', line 5

def stderr
  @stderr
end

#stdoutObject (readonly)

Returns the value of attribute stdout.



5
6
7
# File 'lib/jet_black/executed_command.rb', line 5

def stdout
  @stdout
end

Instance Method Details

#failure?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/jet_black/executed_command.rb', line 21

def failure?
  !success?
end

#success?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/jet_black/executed_command.rb', line 17

def success?
  exit_status.zero?
end