Class: Traceur::Node::CommandResult
- Inherits:
-
Struct
- Object
- Struct
- Traceur::Node::CommandResult
- Defined in:
- lib/traceur/node/command_result.rb
Instance Attribute Summary collapse
-
#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
- #error? ⇒ Boolean
- #exit_status ⇒ Object
-
#initialize(opts = {}) ⇒ CommandResult
constructor
A new instance of CommandResult.
- #on_error {|_self| ... } ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(opts = {}) ⇒ CommandResult
Returns a new instance of CommandResult.
4 5 6 7 8 |
# File 'lib/traceur/node/command_result.rb', line 4 def initialize(opts = {}) self.status = opts[:status] self.stdout = opts[:stdout] self.stderr = opts[:stderr] end |
Instance Attribute Details
#status ⇒ Object
Returns the value of attribute status
3 4 5 |
# File 'lib/traceur/node/command_result.rb', line 3 def status @status end |
#stderr ⇒ Object
Returns the value of attribute stderr
3 4 5 |
# File 'lib/traceur/node/command_result.rb', line 3 def stderr @stderr end |
#stdout ⇒ Object
Returns the value of attribute stdout
3 4 5 |
# File 'lib/traceur/node/command_result.rb', line 3 def stdout @stdout end |
Instance Method Details
#error? ⇒ Boolean
15 16 17 |
# File 'lib/traceur/node/command_result.rb', line 15 def error? !success? end |
#exit_status ⇒ Object
23 24 25 |
# File 'lib/traceur/node/command_result.rb', line 23 def exit_status status.exitstatus end |
#on_error {|_self| ... } ⇒ Object
10 11 12 13 |
# File 'lib/traceur/node/command_result.rb', line 10 def on_error yield(self) if error? self end |
#success? ⇒ Boolean
19 20 21 |
# File 'lib/traceur/node/command_result.rb', line 19 def success? exit_status == 0 end |