lib/rio/scheme/cmdio.rb in rio-0.5.1 vs lib/rio/scheme/cmdio.rb in rio-0.6.0

- old
+ new

@@ -1,8 +1,8 @@ #-- # =========================================================================== -# Copyright (c) 2005-2012 Christopher Kleckner +# Copyright (c) 2005-2017 Christopher Kleckner # All rights reserved # # This file is part of the Rio library for ruby. # # Rio is free software; you can redistribute it and/or modify @@ -38,11 +38,10 @@ RIOSCHEME = 'cmdio' RIOPATH = RIO::RRL::CHMAP.invert[RIOSCHEME].to_s.freeze attr_reader :ior,:iow def initialize(u,*a) - # p "CMDIO initialize: u=#{u.inspect} a=#{a.inspect}" super(u) a = a.map(&:to_s) com = case c = a.shift when self.class then c.cmd else c @@ -50,12 +49,12 @@ unless com.nil? self.path = com self.query = a end end - extend Forwardable - def_delegators :uri, :path=, :path + extend RIO::Fwd + fwd :uri, :path def query uri.query end def query=(args) uri.query = args @@ -65,12 +64,10 @@ new(u,*a) end alias :cmd :path alias :args :query def fib_proc(m) - #fibproc - #p "CMD=#{cmd},args=#{args.inspect}" poargs = args.nil? ? cmd : [cmd,args] if m.allows_write? Cmd::FibPipeProc.new(poargs,m.to_s) else Cmd::FibSourceProc.new(poargs,m.to_s) @@ -80,11 +77,10 @@ def to_s() [cmd,args].flatten.join(' ').strip end def open(m) poarg = args.nil? ? cmd : [cmd,args].flatten - #p "CMDIO poarg=#{poarg.inspect}" io = IO.popen(poarg,m.to_s) super(io) end @@ -95,17 +91,9 @@ class Open < RIO::Stream::Open include Piper::Cp::Input def cmd() rl.path end def cmd_args() rl.query end - #def cmd_str() [cmd,cmd_args].flatten.join(' ') end - #def |(arg) - # #p "CMDIO#| #{self}|#{arg}" - # nrio = new_rio(:cmdpipe,self,arg) - # end_rio = nrio.rl.query[-1] - # p "CmdIO#end_rio=#{end_rio}" - # nrio - #end end end end end