Class: Plywood::CommandReport
- Inherits:
-
Object
- Object
- Plywood::CommandReport
- Extended by:
- Forwardable
- Defined in:
- lib/plywood/command_report.rb
Overview
A small report to show after the command has run.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(command, status) ⇒ CommandReport
constructor
A new instance of CommandReport.
- #to_s ⇒ Object
Constructor Details
#initialize(command, status) ⇒ CommandReport
Returns a new instance of CommandReport.
12 13 14 15 16 17 |
# File 'lib/plywood/command_report.rb', line 12 def initialize(command, status) raise ArgumentError, "command is nil" if command.nil? raise ArgumentError, "status is nil" if status.nil? @command = command @status = status end |
Class Method Details
.gather(status, commands) ⇒ Object
19 20 21 22 |
# File 'lib/plywood/command_report.rb', line 19 def self.gather(status, commands) command = commands.find { |item| item.pid == status.pid } new(command, status) end |
Instance Method Details
#to_s ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/plywood/command_report.rb', line 24 def to_s if success? "#{name} was successful." else "#{name} failed with exit status #{to_i} (`#{command}`)." end end |