class Loom::Shell::CmdRedirect

Public Class Methods

append_stdout(word) click to toggle source
# File lib/loom/shell/cmd_wrapper.rb, line 109
def append_stdout(word)
  CmdRedirect.new(word, mode: Mode::APPEND)
end
new(word, fd: nil, mode: Mode::OUTPUT) click to toggle source
# File lib/loom/shell/cmd_wrapper.rb, line 123
def initialize(word, fd: nil, mode: Mode::OUTPUT)
  @fd = fd
  @word = word
  @mode = mode
end

Public Instance Methods

to_s() click to toggle source
# File lib/loom/shell/cmd_wrapper.rb, line 129
def to_s
  case @mode
  when Mode::INPUT
    "%s<%s" % [@fd, @word]
  when Mode::OUTPUT
    "%s>%s" % [@fd, @word]
  when Mode::APPEND
    "%s>>%s" % [@fd, @word]
  when Mode::OUTPUT_12
    "&>%s" % [@word]
  when Mode::APPEND_12
    "&>>%s" % [@word]
  else
    raise "invalid shell redirection mode: #{@mode}"
  end
end