Class: Configure::AskLoop

Inherits:
Utils::AskLoop show all
Defined in:
lib/ngi/configure.rb

Overview

Here, we implement the virtual class “Utils::AskLoop” (see src/ruby/utils/utils.rb) This implementation just creates a loop that asks for user input

Class Method Summary collapse

Class Method Details

.ask(args) ⇒ Object


36
37
38
39
40
41
42
43
44
45
46
# File 'lib/ngi/configure.rb', line 36

def self.ask(args)
  puts "\nChoose from: #{args[:valid]}"
  answer = AcceptInput.str(:stripped)

  loop do
    break if args[:check].include?(answer)
    puts "Choose from: #{args[:valid]}\n(or press ctrl+c to exit)"
    answer = AcceptInput.str(:stripped)
  end
  answer
end