Class: OsCtl::Lib::SystemCommandResult
- Inherits:
-
Object
- Object
- OsCtl::Lib::SystemCommandResult
- Defined in:
- lib/libosctl/system_command_result.rb
Instance Attribute Summary collapse
- #exitstatus ⇒ Integer readonly
- #output ⇒ String readonly
Instance Method Summary collapse
- #[](key) ⇒ Object
- #error? ⇒ Boolean
-
#initialize(exitstatus, output) ⇒ SystemCommandResult
constructor
A new instance of SystemCommandResult.
- #success? ⇒ Boolean
Constructor Details
#initialize(exitstatus, output) ⇒ SystemCommandResult
Returns a new instance of SystemCommandResult.
11 12 13 14 |
# File 'lib/libosctl/system_command_result.rb', line 11 def initialize(exitstatus, output) @exitstatus = exitstatus @output = output end |
Instance Attribute Details
#exitstatus ⇒ Integer (readonly)
4 5 6 |
# File 'lib/libosctl/system_command_result.rb', line 4 def exitstatus @exitstatus end |
#output ⇒ String (readonly)
7 8 9 |
# File 'lib/libosctl/system_command_result.rb', line 7 def output @output end |
Instance Method Details
#[](key) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/libosctl/system_command_result.rb', line 24 def [](key) warn "Accessing command result using [#{key}] is deprecated" warn 'Caller backtrace:' warn caller.join("\n") send(key) end |
#error? ⇒ Boolean
20 21 22 |
# File 'lib/libosctl/system_command_result.rb', line 20 def error? !success? end |
#success? ⇒ Boolean
16 17 18 |
# File 'lib/libosctl/system_command_result.rb', line 16 def success? exitstatus == 0 end |