Module: Terraspace::Util::Sure
- Defined in:
- lib/terraspace/util/sure.rb
Instance Method Summary collapse
Instance Method Details
#sure?(message = "Are you sure?", desc = nil) ⇒ Boolean
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/terraspace/util/sure.rb', line 3 def sure?(="Are you sure?", desc=nil) if @options[:yes] sure = 'y' else out = if desc "\n#{desc}\n#{} (y/N) " else "#{} (y/N) " end print out sure = $stdin.gets end unless sure =~ /^y/ puts "Whew! Exiting." exit 0 end end |