Class: RIO::CmdIO::RRL

Inherits:
RRL::SysIOBase
  • Object
show all
Extended by:
Fwd
Defined in:
lib/rio/scheme/cmdio.rb

Constant Summary collapse

RIOSCHEME =
'cmdio'
RIOPATH =
RIO::RRL::CHMAP.invert[RIOSCHEME].to_s.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Fwd

fwd, fwd_reader, fwd_readers, fwd_writer, fwd_writers

Constructor Details

#initialize(u, *a) ⇒ RRL

Returns a new instance of RRL.



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/rio/scheme/cmdio.rb', line 42

def initialize(u,*a)
  super(u)
  a = a.map(&:to_s)
  com = case c = a.shift
        when self.class then c.cmd
        else c
        end
  unless com.nil?
    self.path = com
    self.query = a
  end
end

Instance Attribute Details

#iorObject (readonly)

Returns the value of attribute ior.



41
42
43
# File 'lib/rio/scheme/cmdio.rb', line 41

def ior
  @ior
end

#iowObject (readonly)

Returns the value of attribute iow.



41
42
43
# File 'lib/rio/scheme/cmdio.rb', line 41

def iow
  @iow
end

Class Method Details

.parse(*a) ⇒ Object



62
63
64
65
# File 'lib/rio/scheme/cmdio.rb', line 62

def self.parse(*a)
  u = a.shift.sub(/^rio:/,'')
  new(u,*a)
end

Instance Method Details

#fib_proc(m) ⇒ Object



68
69
70
71
72
73
74
75
# File 'lib/rio/scheme/cmdio.rb', line 68

def fib_proc(m)
  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)
  end
end

#open(m) ⇒ Object



80
81
82
83
84
# File 'lib/rio/scheme/cmdio.rb', line 80

def open(m)
  poarg = args.nil? ? cmd : [cmd,args].flatten
  io = IO.popen(poarg,m.to_s)
  super(io)
end

#queryObject Also known as: args



56
57
58
# File 'lib/rio/scheme/cmdio.rb', line 56

def query
  uri.query
end

#query=(args) ⇒ Object



59
60
61
# File 'lib/rio/scheme/cmdio.rb', line 59

def query=(args)
  uri.query = args
end

#to_sObject



77
78
79
# File 'lib/rio/scheme/cmdio.rb', line 77

def to_s()
  [cmd,args].flatten.join(' ').strip
end