class Warg::Localhost::CommandOutcome

Attributes

error[RW]

Public Class Methods

new() click to toggle source
# File lib/warg.rb, line 631
def initialize
  @console_status = Console::HostStatus.new(LOCALHOST, Warg.console)
  @started_at = nil
  @finished_at = nil
end

Public Instance Methods

command_finished!() click to toggle source
# 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!() click to toggle source
# File lib/warg.rb, line 645
def command_started!
  @started_at = Time.now
  @started_at.freeze

  @console_status.started!
end
duration() click to toggle source
# File lib/warg.rb, line 679
def duration
  if @started_at && @finished_at
    @finished_at - @started_at
  end
end
failed?() click to toggle source
# File lib/warg.rb, line 667
def failed?
  !successful?
end
failure_summary() click to toggle source
# File lib/warg.rb, line 685
def failure_summary
  error && error.full_message
end
finished?() click to toggle source
# File lib/warg.rb, line 675
def finished?
  not @finished_at.nil?
end
host() click to toggle source
# File lib/warg.rb, line 637
def host
  LOCALHOST
end
started?() click to toggle source
# File lib/warg.rb, line 671
def started?
  not @started_at.nil?
end
successful?() click to toggle source
# File lib/warg.rb, line 663
def successful?
  error.nil?
end
value() click to toggle source
# File lib/warg.rb, line 641
def value
  self
end