Class: SubSpawn::Internal::FdSource::Pipe
- Inherits:
-
Open
- Object
- SubSpawn::Internal::FdSource
- Open
- SubSpawn::Internal::FdSource::Pipe
- Defined in:
- lib/subspawn/fd_types.rb
Instance Attribute Summary
Attributes inherited from SubSpawn::Internal::FdSource
Instance Method Summary collapse
- #apply(base) ⇒ Object
-
#initialize(dests, dir) ⇒ Pipe
constructor
A new instance of Pipe.
Methods inherited from SubSpawn::Internal::FdSource
#before?, #depends?, #destroys?, #heads, #max, #raw_apply, #tails, #to_dbg
Constructor Details
#initialize(dests, dir) ⇒ Pipe
Returns a new instance of Pipe.
121 122 123 124 |
# File 'lib/subspawn/fd_types.rb', line 121 def initialize(dests, dir) super(dests) @dir = dir end |
Instance Method Details
#apply(base) ⇒ Object
125 126 127 128 129 130 131 132 |
# File 'lib/subspawn/fd_types.rb', line 125 def apply base @saved ||= IO.pipe r, w = {read: @saved, write: @saved.reverse}[@dir] raw_apply base, r @dests.each {|dest| base.fd_close(w) } # if you want the other end, pass it in yourself SubSpawn::IoHolder::Pipe.new(w, r) end |