Module: RIO::Piper::Cp::Input

Includes:
Util
Included in:
Ops::File::Existing, Ops::Stream::Input, Stream::Duplex::Open
Defined in:
lib/rio/piper/cp.rb

Instance Method Summary collapse

Instance Method Details

#has_output_dest?(nrio) ⇒ Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/rio/piper/cp.rb', line 68

def has_output_dest?(nrio)
  !%w[cmdio cmdpipe].include?(last_rio(nrio).scheme)
end

#last_rio(r) ⇒ Object



64
65
66
67
# File 'lib/rio/piper/cp.rb', line 64

def last_rio(r)
  r = r.rl.query[-1] while r.scheme == 'cmdpipe'
  r
end

#|(arg) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
# File 'lib/rio/piper/cp.rb', line 72

def |(arg)
  ario = ensure_cmd_rio(arg)
  nrio = new_rio(:cmdpipe,self.clone_rio,ario)
  
  if has_output_dest?(nrio) 
    nrio.run 
  else
    nrio
  end

end