Class: Configure::AskLoop
- Inherits:
-
Utils::AskLoop
- Object
- Utils::AskLoop
- Configure::AskLoop
- 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
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ngi/configure.rb', line 25 def self.ask(args) puts "\nChoose from: #{args[:valid]}" answer = $stdin.gets.strip loop do break if args[:check].include?(answer) puts "Choose from: #{args[:valid]}\n(or press ctrl+c to exit)" answer = $stdin.gets.strip end answer end |