Class: Generator::AskLoop

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

Overview

Here we just implement the virtual class Utils::AskLoop

Class Method Summary collapse

Class Method Details

.ask(args) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ngi/generator.rb', line 15

def self.ask(args)
  print "\n#{args[:prompt]}"

  answer = $stdin.gets.strip.downcase

  loop do
    break if args[:check] == answer
    puts 'Exited!'
    exit
  end

  answer
end