Sha256: 6804c8c542bab603a0a69e411bce24418411674ef47cd4720d32e331f4c0bc47

Contents?: true

Size: 527 Bytes

Versions: 1

Compression:

Stored size: 527 Bytes

Contents

class HalfShell::Result
  
  attr_reader :command, :status, :stderr, :stdout
  
  def initialize(command, status, stdout, stderr)
    @command = command
    @status, @stdout, @stderr = status, stdout, stderr
  end
  
  def to_s
    %Q{#<HalfShell::Result command="#{shorten(command)}" status=#{status} stdout="#{shorten(stdout)}" stderr="#{shorten(stderr)}">}
  end
  
  private
  
  def shorten(str)
    chars = 10
    str.gsub(/\n/, '\n')[0..(str.size > chars ? chars - 3 : -1)] + (str.size > chars ? '...' : '')
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
half_shell-0.0.3 lib/half_shell/result.rb