Class: HighLine::Test::Driver

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input_stream, output_stream) ⇒ Driver

Returns a new instance of Driver.



8
9
10
11
# File 'lib/highline/test/driver.rb', line 8

def initialize(input_stream, output_stream)
  @input_stream = input_stream
  @output_stream = output_stream
end

Instance Attribute Details

#input_streamObject (readonly)

Returns the value of attribute input_stream.



5
6
7
# File 'lib/highline/test/driver.rb', line 5

def input_stream
  @input_stream
end

#output_streamObject (readonly)

Returns the value of attribute output_stream.



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

def output_stream
  @output_stream
end

Instance Method Details

#high_lineObject

Creates and returns a HighLine instance, set up to use the supplied streams



14
15
16
17
18
# File 'lib/highline/test/driver.rb', line 14

def high_line
  return @high_line if @high_line
  HighLine.track_eof = false
  @high_line = HighLine.new(input_stream, output_stream)
end

#inject(text) ⇒ Object

Adds text to the output stream



21
22
23
# File 'lib/highline/test/driver.rb', line 21

def inject(text)
  @output_stream << text
end