Class: TTK::Streams::Pipe::PipeWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/ttk/strategies/Streams/Pipe.rb

Instance Method Summary collapse

Constructor Details

#initialize(input) ⇒ PipeWrapper

attr_reader :rd, :wr



14
15
16
17
# File 'lib/ttk/strategies/Streams/Pipe.rb', line 14

def initialize ( input )
  # @input = input
  @rd, @wr = IO.pipe
end

Instance Method Details

#exist?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/ttk/strategies/Streams/Pipe.rb', line 26

def exist?
  true
end

#open(mode = 'r') ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/ttk/strategies/Streams/Pipe.rb', line 18

def open ( mode='r' )
  case mode
  when 'r' then @rd
  when 'w' then @wr
  else
    raise
  end
end

#readObject



29
30
31
# File 'lib/ttk/strategies/Streams/Pipe.rb', line 29

def read
  @rd.read
end