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
Returns a new instance of CommandOutcome.
631 632 633 634 635 |
# File 'lib/warg.rb', line 631 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.
629 630 631 |
# File 'lib/warg.rb', line 629 def error @error end |
Instance Method Details
#command_finished! ⇒ Object
652 653 654 655 656 657 658 659 660 661 |
# File 'lib/warg.rb', line 652 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
645 646 647 648 649 650 |
# File 'lib/warg.rb', line 645 def command_started! @started_at = Time.now @started_at.freeze @console_status.started! end |
#duration ⇒ Object
679 680 681 682 683 |
# File 'lib/warg.rb', line 679 def duration if @started_at && @finished_at @finished_at - @started_at end end |
#failed? ⇒ Boolean
667 668 669 |
# File 'lib/warg.rb', line 667 def failed? !successful? end |
#failure_summary ⇒ Object
685 686 687 |
# File 'lib/warg.rb', line 685 def failure_summary error && error. end |
#finished? ⇒ Boolean
675 676 677 |
# File 'lib/warg.rb', line 675 def finished? not @finished_at.nil? end |
#host ⇒ Object
637 638 639 |
# File 'lib/warg.rb', line 637 def host LOCALHOST end |
#started? ⇒ Boolean
671 672 673 |
# File 'lib/warg.rb', line 671 def started? not @started_at.nil? end |
#successful? ⇒ Boolean
663 664 665 |
# File 'lib/warg.rb', line 663 def successful? error.nil? end |
#value ⇒ Object
641 642 643 |
# File 'lib/warg.rb', line 641 def value self end |