Sha256: 7b6721eb3052b3a95485d17da4f2333bf4221db5c8a859c14bcf1340f74bdf99
Contents?: true
Size: 1.32 KB
Versions: 2
Compression:
Stored size: 1.32 KB
Contents
# encoding: utf-8 module TTY class Command # Encapsulates the information on the command executed # # @api public class Result def initialize(status, out, err) @status = status @out = out @err = err end # All data written out to process's stdout stream def out @out end alias_method :stdout, :out # All data written out to process's stdin stream def err @err end alias_method :stderr, :err # Information on how the process exited # # @api public def exit_status @status end alias_method :exitstatus, :exit_status alias_method :status, :exit_status def to_i @status end def to_s @status.to_s end def to_ary [@out, @err] end def exited? @status != nil end alias_method :complete?, :exited? def success? if exited? @status == 0 else false end end def failure? !success? end alias_method :failed?, :failure? def ==(other) return false unless other.is_a?(TTY::Command::Result) @status == other.to_i && to_ary == other.to_ary end end # Result end # Command end # TTY
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tty-command-0.2.0 | lib/tty/command/result.rb |
tty-command-0.1.0 | lib/tty/command/result.rb |