Class: TTY2::Prompt::Test

Inherits:
TTY2::Prompt show all
Defined in:
lib/tty2/prompt/test.rb

Constant Summary

Constants inherited from TTY2::Prompt

ArgumentRequired, ArgumentValidation, ConfigurationError, ConversionAlreadyDefined, ConversionError, Error, InvalidArgument, UnsupportedConversion, VERSION, ValidationCoercion

Instance Attribute Summary

Attributes inherited from TTY2::Prompt

#active_color, #cursor, #enabled_color, #error_color, #help_color, #input, #output, #prefix, #quiet, #reader, #symbols

Instance Method Summary collapse

Methods inherited from TTY2::Prompt

#ask, #collect, #debug, #decorate, #enum_select, #error, #expand, #inspect, #invoke_question, #invoke_select, #keypress, #mask, messages, #multi_select, #multiline, #no?, #ok, #say, #select, #slider, #stderr, #stdin, #stdout, #suggest, #tty?, #warn, #yes?

Constructor Details

#initialize(**options) ⇒ Test

Returns a new instance of Test.



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/tty2/prompt/test.rb', line 21

def initialize(**options)
  @input = StringIO.new
  @input.extend(StringIOExtensions)
  @output = StringIO.new

  options.merge!({
    input: @input,
    output: @output,
    env: { "TTY2_TEST" => true },
    enable_color: options.fetch(:enable_color, true)
  })
  super(**options)
end