class TapDance::ShellResult
Attributes
err[R]
out[R]
status[R]
Public Class Methods
new(out, err=nil, status=0)
click to toggle source
# File lib/tap_dance/shell_result.rb, line 35 def initialize(out, err=nil, status=0) @out = out.to_s @err = err.to_s @status = status end
of(cmd)
click to toggle source
# File lib/tap_dance/shell_result.rb, line 25 def self.of(cmd) out = nil err = nil sts = open4(cmd) do |pid, stdin, stdout, stderr| out = stdout.read err = stderr.read end new out, err, sts.exitstatus end
Public Instance Methods
error?()
click to toggle source
# File lib/tap_dance/shell_result.rb, line 45 def error? @status != 0 || erred(@out) || erred(@err) end
okay?()
click to toggle source
# File lib/tap_dance/shell_result.rb, line 41 def okay? !error? end
stderr?()
click to toggle source
# File lib/tap_dance/shell_result.rb, line 53 def stderr? @err.strip != "" end
stdout?()
click to toggle source
# File lib/tap_dance/shell_result.rb, line 49 def stdout? @out.strip != "" end
to_s()
click to toggle source
# File lib/tap_dance/shell_result.rb, line 57 def to_s if @out.strip == "" then @err else @out end end
Private Instance Methods
erred(string)
click to toggle source
def respond_to_missing?(method, include_private = false)
String.new.respond_to?(method) || super
end
# File lib/tap_dance/shell_result.rb, line 77 def erred(string) string[0..4] == 'Error' end