Class: HighLine::Test::PartialReader

Inherits:
Object
  • Object
show all
Defined in:
lib/highline/test/partial_reader.rb

Overview

Wraps a pipe, supplying a non-blocking #gets method

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stream) ⇒ PartialReader

Returns a new instance of PartialReader.



6
7
8
# File 'lib/highline/test/partial_reader.rb', line 6

def initialize(stream)
  @stream = stream
end

Instance Attribute Details

#streamObject (readonly)

Returns the value of attribute stream.



4
5
6
# File 'lib/highline/test/partial_reader.rb', line 4

def stream
  @stream
end

Instance Method Details

#getsObject



10
11
12
# File 'lib/highline/test/partial_reader.rb', line 10

def gets
  stream.readpartial(PIPE_BUFFER_SIZE)
end