Class: Warg::Localhost::CommandOutcome
- Inherits:
-
Object
- Object
- Warg::Localhost::CommandOutcome
- Defined in:
- lib/warg.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
Returns the value of attribute error.
Instance Method Summary collapse
- #command_finished! ⇒ Object
- #command_started! ⇒ Object
- #duration ⇒ Object
- #failed? ⇒ Boolean
- #failure_summary ⇒ Object
- #finished? ⇒ Boolean
- #host ⇒ Object
-
#initialize ⇒ CommandOutcome
constructor
A new instance of CommandOutcome.
- #started? ⇒ Boolean
- #successful? ⇒ Boolean
- #value ⇒ Object
Constructor Details
#initialize ⇒ CommandOutcome
632 633 634 635 636 |
# File 'lib/warg.rb', line 632 def initialize @console_status = Console::HostStatus.new(LOCALHOST, Warg.console) @started_at = nil @finished_at = nil end |
Instance Attribute Details
#error ⇒ Object
Returns the value of attribute error.
630 631 632 |
# File 'lib/warg.rb', line 630 def error @error end |
Instance Method Details
#command_finished! ⇒ Object
653 654 655 656 657 658 659 660 661 662 |
# File 'lib/warg.rb', line 653 def command_finished! @finished_at = Time.now @finished_at.freeze if successful? @console_status.success! else @console_status.failed!(failure_summary) end end |
#command_started! ⇒ Object
646 647 648 649 650 651 |
# File 'lib/warg.rb', line 646 def command_started! @started_at = Time.now @started_at.freeze @console_status.started! end |
#duration ⇒ Object
680 681 682 683 684 |
# File 'lib/warg.rb', line 680 def duration if @started_at && @finished_at @finished_at - @started_at end end |
#failed? ⇒ Boolean
668 669 670 |
# File 'lib/warg.rb', line 668 def failed? !successful? end |
#failure_summary ⇒ Object
686 687 688 |
# File 'lib/warg.rb', line 686 def failure_summary error && error. end |
#finished? ⇒ Boolean
676 677 678 |
# File 'lib/warg.rb', line 676 def finished? not @finished_at.nil? end |
#host ⇒ Object
638 639 640 |
# File 'lib/warg.rb', line 638 def host LOCALHOST end |
#started? ⇒ Boolean
672 673 674 |
# File 'lib/warg.rb', line 672 def started? not @started_at.nil? end |
#successful? ⇒ Boolean
664 665 666 |
# File 'lib/warg.rb', line 664 def successful? error.nil? end |
#value ⇒ Object
642 643 644 |
# File 'lib/warg.rb', line 642 def value self end |