Method: Intar::RedirectFile.detect

Defined in:
lib/intar/redirect.rb

.detect(line, outfile) ⇒ Object



52
53
54
55
56
57
58
59
60
# File 'lib/intar/redirect.rb', line 52

def detect line, outfile
  if line.slice! /\s+>(>)?(\S+|"((?:[^\\"]|\\.)*)")\z/ then
    p = $3 ? ($3.gsub /\\(.)/, "\\1") : $2
    append = true if $1
    new p, append
  elsif outfile then
    new outfile.to_s, true
  end
end