Class: SmartBox::CommandResult
- Inherits:
-
Object
- Object
- SmartBox::CommandResult
- Defined in:
- lib/smart_box/command_result.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#cwd ⇒ Object
readonly
Returns the value of attribute cwd.
-
#ended_at ⇒ Object
readonly
Returns the value of attribute ended_at.
-
#exit_code ⇒ Object
readonly
Returns the value of attribute exit_code.
-
#started_at ⇒ Object
readonly
Returns the value of attribute started_at.
-
#stderr ⇒ Object
readonly
Returns the value of attribute stderr.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
Instance Method Summary collapse
- #elapsed_ms ⇒ Object
-
#initialize(command:, cwd:, stdout:, stderr:, exit_code:, started_at:, ended_at:) ⇒ CommandResult
constructor
A new instance of CommandResult.
- #success? ⇒ Boolean
Constructor Details
#initialize(command:, cwd:, stdout:, stderr:, exit_code:, started_at:, ended_at:) ⇒ CommandResult
Returns a new instance of CommandResult.
7 8 9 10 11 12 13 14 15 |
# File 'lib/smart_box/command_result.rb', line 7 def initialize(command:, cwd:, stdout:, stderr:, exit_code:, started_at:, ended_at:) @command = command @cwd = cwd @stdout = stdout @stderr = stderr @exit_code = exit_code @started_at = started_at @ended_at = ended_at end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
5 6 7 |
# File 'lib/smart_box/command_result.rb', line 5 def command @command end |
#cwd ⇒ Object (readonly)
Returns the value of attribute cwd.
5 6 7 |
# File 'lib/smart_box/command_result.rb', line 5 def cwd @cwd end |
#ended_at ⇒ Object (readonly)
Returns the value of attribute ended_at.
5 6 7 |
# File 'lib/smart_box/command_result.rb', line 5 def ended_at @ended_at end |
#exit_code ⇒ Object (readonly)
Returns the value of attribute exit_code.
5 6 7 |
# File 'lib/smart_box/command_result.rb', line 5 def exit_code @exit_code end |
#started_at ⇒ Object (readonly)
Returns the value of attribute started_at.
5 6 7 |
# File 'lib/smart_box/command_result.rb', line 5 def started_at @started_at end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
5 6 7 |
# File 'lib/smart_box/command_result.rb', line 5 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
5 6 7 |
# File 'lib/smart_box/command_result.rb', line 5 def stdout @stdout end |
Instance Method Details
#elapsed_ms ⇒ Object
21 22 23 |
# File 'lib/smart_box/command_result.rb', line 21 def elapsed_ms ((@ended_at - @started_at) * 1000).to_i end |
#success? ⇒ Boolean
17 18 19 |
# File 'lib/smart_box/command_result.rb', line 17 def success? @exit_code == 0 end |