class Anywhere::Result
Attributes
cmd[RW]
exit_status[RW]
stderr[RW]
stdout[RW]
Public Class Methods
new(cmd)
click to toggle source
# File lib/anywhere/result.rb, line 5 def initialize(cmd) @cmd = cmd @stdout = [] @stderr = [] end
Public Instance Methods
add_stderr(line)
click to toggle source
# File lib/anywhere/result.rb, line 11 def add_stderr(line) @stderr << line end
add_stdout(line)
click to toggle source
# File lib/anywhere/result.rb, line 15 def add_stdout(line) @stdout << line end
finished!(time = Time.now)
click to toggle source
# File lib/anywhere/result.rb, line 31 def finished!(time = Time.now) @finished = time end
inspect()
click to toggle source
# File lib/anywhere/result.rb, line 43 def inspect parts = ["run_time=#{run_time}"] parts << "cmd=<#{@cmd}>" parts << "stdout=#{inspect_string(@stdout)}" parts << "stderr=#{inspect_string(@stderr)}" parts << "exit_status=#{@exit_status}" "<" + parts.join(", ") + ">" end
inspect_string(string)
click to toggle source
# File lib/anywhere/result.rb, line 52 def inspect_string(string) if string.empty? "<empty>" else "<#{string.count} lines, #{string.join(" ").length} chars>" end end
run_time()
click to toggle source
# File lib/anywhere/result.rb, line 39 def run_time @finished - @started end
started!(time = Time.now)
click to toggle source
# File lib/anywhere/result.rb, line 27 def started!(time = Time.now) @started = time end
success?()
click to toggle source
# File lib/anywhere/result.rb, line 35 def success? @exit_status == 0 end