Class: Knife::Pkg::ShellCommandResult
- Inherits:
-
Object
- Object
- Knife::Pkg::ShellCommandResult
- Defined in:
- lib/knife-pkg/shell_command_result.rb
Instance Attribute Summary collapse
-
#cmd ⇒ Object
Returns the value of attribute cmd.
-
#exit_code ⇒ Object
Returns the value of attribute exit_code.
-
#stderr ⇒ Object
Returns the value of attribute stderr.
-
#stdout ⇒ Object
Returns the value of attribute stdout.
Instance Method Summary collapse
-
#initialize(cmd, stdout, stderr, exit_code) ⇒ ShellCommandResult
constructor
A new instance of ShellCommandResult.
- #succeeded? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(cmd, stdout, stderr, exit_code) ⇒ ShellCommandResult
Returns a new instance of ShellCommandResult.
26 27 28 29 30 31 |
# File 'lib/knife-pkg/shell_command_result.rb', line 26 def initialize(cmd, stdout, stderr, exit_code) @cmd = cmd @stdout = stdout @stderr = stderr @exit_code = exit_code end |
Instance Attribute Details
#cmd ⇒ Object
Returns the value of attribute cmd.
21 22 23 |
# File 'lib/knife-pkg/shell_command_result.rb', line 21 def cmd @cmd end |
#exit_code ⇒ Object
Returns the value of attribute exit_code.
24 25 26 |
# File 'lib/knife-pkg/shell_command_result.rb', line 24 def exit_code @exit_code end |
#stderr ⇒ Object
Returns the value of attribute stderr.
23 24 25 |
# File 'lib/knife-pkg/shell_command_result.rb', line 23 def stderr @stderr end |
#stdout ⇒ Object
Returns the value of attribute stdout.
22 23 24 |
# File 'lib/knife-pkg/shell_command_result.rb', line 22 def stdout @stdout end |
Instance Method Details
#succeeded? ⇒ Boolean
37 38 39 |
# File 'lib/knife-pkg/shell_command_result.rb', line 37 def succeeded? return @exit_code.to_i == 0 ? true : false end |
#to_s ⇒ Object
33 34 35 |
# File 'lib/knife-pkg/shell_command_result.rb', line 33 def to_s return "Command: \"#{@cmd}\", stdout: \"#{@stdout}\", stderr: \"#{@stderr}\", exit_code: \"#{@exit_code}\"" end |