Class: ExecutedShellCommand::Result
- Defined in:
- lib/executed_shell_command.rb
Overview
Immutable value object representing the outcome of a command execution.
Instance Attribute Summary collapse
-
#chdir ⇒ Object
Returns the value of attribute chdir.
-
#command ⇒ Object
Returns the value of attribute command.
-
#env ⇒ Object
Returns the value of attribute env.
-
#finished_at ⇒ Object
Returns the value of attribute finished_at.
-
#pid ⇒ Object
Returns the value of attribute pid.
-
#started_at ⇒ Object
Returns the value of attribute started_at.
-
#status ⇒ Object
Returns the value of attribute status.
-
#stderr ⇒ Object
Returns the value of attribute stderr.
-
#stdout ⇒ Object
Returns the value of attribute stdout.
Instance Method Summary collapse
- #duration ⇒ Object
- #exit_code ⇒ Object
- #signaled? ⇒ Boolean
- #success? ⇒ Boolean
- #termsig ⇒ Object
- #to_h ⇒ Object
Instance Attribute Details
#chdir ⇒ Object
Returns the value of attribute chdir
35 36 37 |
# File 'lib/executed_shell_command.rb', line 35 def chdir @chdir end |
#command ⇒ Object
Returns the value of attribute command
35 36 37 |
# File 'lib/executed_shell_command.rb', line 35 def command @command end |
#env ⇒ Object
Returns the value of attribute env
35 36 37 |
# File 'lib/executed_shell_command.rb', line 35 def env @env end |
#finished_at ⇒ Object
Returns the value of attribute finished_at
35 36 37 |
# File 'lib/executed_shell_command.rb', line 35 def finished_at @finished_at end |
#pid ⇒ Object
Returns the value of attribute pid
35 36 37 |
# File 'lib/executed_shell_command.rb', line 35 def pid @pid end |
#started_at ⇒ Object
Returns the value of attribute started_at
35 36 37 |
# File 'lib/executed_shell_command.rb', line 35 def started_at @started_at end |
#status ⇒ Object
Returns the value of attribute status
35 36 37 |
# File 'lib/executed_shell_command.rb', line 35 def status @status end |
#stderr ⇒ Object
Returns the value of attribute stderr
35 36 37 |
# File 'lib/executed_shell_command.rb', line 35 def stderr @stderr end |
#stdout ⇒ Object
Returns the value of attribute stdout
35 36 37 |
# File 'lib/executed_shell_command.rb', line 35 def stdout @stdout end |
Instance Method Details
#duration ⇒ Object
55 56 57 58 59 |
# File 'lib/executed_shell_command.rb', line 55 def duration return nil unless started_at && finished_at finished_at - started_at end |
#exit_code ⇒ Object
51 52 53 |
# File 'lib/executed_shell_command.rb', line 51 def exit_code status&.exitstatus end |
#signaled? ⇒ Boolean
61 62 63 |
# File 'lib/executed_shell_command.rb', line 61 def signaled? status&.signaled? end |
#success? ⇒ Boolean
47 48 49 |
# File 'lib/executed_shell_command.rb', line 47 def success? status&.success? end |
#termsig ⇒ Object
65 66 67 |
# File 'lib/executed_shell_command.rb', line 65 def termsig status&.termsig end |
#to_h ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/executed_shell_command.rb', line 69 def to_h { command: command, stdout: stdout, stderr: stderr, exit_code: exit_code, success: success?, started_at: started_at, finished_at: finished_at, duration: duration, pid: pid, env: env, chdir: chdir, status: status } end |