Class: Gitw::ExecResult
- Inherits:
-
Object
- Object
- Gitw::ExecResult
- Extended by:
- Forwardable
- Defined in:
- lib/gitw/exec.rb
Overview
exec result
Instance Attribute Summary collapse
-
#commands ⇒ Object
readonly
Returns the value of attribute commands.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#stderr ⇒ Object
readonly
Returns the value of attribute stderr.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(commands:, options:, status:, stdout:, stderr:) ⇒ ExecResult
constructor
A new instance of ExecResult.
- #raise_on_failure(exception = RuntimeError) ⇒ Object
Constructor Details
#initialize(commands:, options:, status:, stdout:, stderr:) ⇒ ExecResult
Returns a new instance of ExecResult.
42 43 44 45 46 47 48 |
# File 'lib/gitw/exec.rb', line 42 def initialize(commands:, options:, status:, stdout:, stderr:) @commands = commands @options = @status = status @stdout = stdout @stderr = stderr end |
Instance Attribute Details
#commands ⇒ Object (readonly)
Returns the value of attribute commands.
40 41 42 |
# File 'lib/gitw/exec.rb', line 40 def commands @commands end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
40 41 42 |
# File 'lib/gitw/exec.rb', line 40 def @options end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
40 41 42 |
# File 'lib/gitw/exec.rb', line 40 def status @status end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
40 41 42 |
# File 'lib/gitw/exec.rb', line 40 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
40 41 42 |
# File 'lib/gitw/exec.rb', line 40 def stdout @stdout end |
Class Method Details
.from_exception(exception, commands: nil, options: nil) ⇒ Object
56 57 58 59 60 61 62 63 |
# File 'lib/gitw/exec.rb', line 56 def self.from_exception(exception, commands: nil, options: nil) exception.extend AsAProcessStatus new(commands: commands, options: , status: exception, stdout: nil, stderr: "Exception: #{exception}") end |
Instance Method Details
#raise_on_failure(exception = RuntimeError) ⇒ Object
50 51 52 53 54 |
# File 'lib/gitw/exec.rb', line 50 def raise_on_failure(exception = RuntimeError) return if success? raise exception, "git exited #{exitstatus}: #{stderr}" end |