Class: Specinfra::CommandResult
- Inherits:
-
Object
- Object
- Specinfra::CommandResult
- Defined in:
- lib/specinfra/command_result.rb
Instance Attribute Summary collapse
-
#exit_signal ⇒ Object
readonly
Returns the value of attribute exit_signal.
-
#exit_status ⇒ Object
readonly
Returns the value of attribute exit_status.
-
#stderr ⇒ Object
readonly
Returns the value of attribute stderr.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
Instance Method Summary collapse
- #[](x) ⇒ Object
- #failure? ⇒ Boolean
-
#initialize(args = {}) ⇒ CommandResult
constructor
A new instance of CommandResult.
- #success? ⇒ Boolean
Constructor Details
#initialize(args = {}) ⇒ CommandResult
Returns a new instance of CommandResult.
5 6 7 8 9 10 |
# File 'lib/specinfra/command_result.rb', line 5 def initialize(args = {}) @stdout = args[:stdout] || '' @stderr = args[:stderr] || '' @exit_status = args[:exit_status] || 0 @exit_signal = args[:exit_signal] end |
Instance Attribute Details
#exit_signal ⇒ Object (readonly)
Returns the value of attribute exit_signal.
3 4 5 |
# File 'lib/specinfra/command_result.rb', line 3 def exit_signal @exit_signal end |
#exit_status ⇒ Object (readonly)
Returns the value of attribute exit_status.
3 4 5 |
# File 'lib/specinfra/command_result.rb', line 3 def exit_status @exit_status end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
3 4 5 |
# File 'lib/specinfra/command_result.rb', line 3 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
3 4 5 |
# File 'lib/specinfra/command_result.rb', line 3 def stdout @stdout end |
Instance Method Details
#[](x) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/specinfra/command_result.rb', line 20 def [](x) warn "CommandResult#[] is obsolete. Use accessors instead. in #{caller[0]}" case x when :stdout, :stderr, :exit_status, :exit_signal self.send(x) end end |
#failure? ⇒ Boolean
16 17 18 |
# File 'lib/specinfra/command_result.rb', line 16 def failure? @exit_status != 0 end |
#success? ⇒ Boolean
12 13 14 |
# File 'lib/specinfra/command_result.rb', line 12 def success? @exit_status == 0 end |