Class: Loom::Shell::CmdResult
- Inherits:
-
Object
- Object
- Loom::Shell::CmdResult
- Defined in:
- lib/loom/shell/cmd_result.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#exit_status ⇒ Object
readonly
Returns the value of attribute exit_status.
-
#is_test ⇒ Object
readonly
Returns the value of attribute is_test.
-
#stderr ⇒ Object
readonly
Returns the value of attribute stderr.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(command, stdout, stderr, exit_status, is_test, shell) ⇒ CmdResult
constructor
A new instance of CmdResult.
- #pipe(*cmd, fd: :stdout) ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(command, stdout, stderr, exit_status, is_test, shell) ⇒ CmdResult
Returns a new instance of CmdResult.
3 4 5 6 7 8 9 10 11 |
# File 'lib/loom/shell/cmd_result.rb', line 3 def initialize(command, stdout, stderr, exit_status, is_test, shell) @command = command @stdout = stdout @stderr = stderr @exit_status = exit_status @is_test = is_test @time = Time.now @shell = shell end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
13 14 15 |
# File 'lib/loom/shell/cmd_result.rb', line 13 def command @command end |
#exit_status ⇒ Object (readonly)
Returns the value of attribute exit_status.
13 14 15 |
# File 'lib/loom/shell/cmd_result.rb', line 13 def exit_status @exit_status end |
#is_test ⇒ Object (readonly)
Returns the value of attribute is_test.
13 14 15 |
# File 'lib/loom/shell/cmd_result.rb', line 13 def is_test @is_test end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
13 14 15 |
# File 'lib/loom/shell/cmd_result.rb', line 13 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
13 14 15 |
# File 'lib/loom/shell/cmd_result.rb', line 13 def stdout @stdout end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
13 14 15 |
# File 'lib/loom/shell/cmd_result.rb', line 13 def time @time end |
Class Method Details
Instance Method Details
#pipe(*cmd, fd: :stdout) ⇒ Object
19 20 21 22 |
# File 'lib/loom/shell/cmd_result.rb', line 19 def pipe(*cmd, fd: :stdout) puts "stdout >>> " + @stdout.inspect @shell.pipe [:"/bin/echo", "-e", @stdout], [*cmd] end |
#success? ⇒ Boolean
15 16 17 |
# File 'lib/loom/shell/cmd_result.rb', line 15 def success? @exit_status == 0 end |