Module: Util

Defined in:
lib/util.rb

Class Method Summary collapse

Class Method Details

.prompt(msg, prompt = "(y)es, (n)o ") ⇒ Object


2
3
4
5
6
7
8
9
# File 'lib/util.rb', line 2

def self.prompt(msg, prompt = "(y)es, (n)o ")
  answer = Capistrano::CLI.ui.ask("#{msg} #{prompt} ? ") do |q|
    q.overwrite = false
    q.validate = /^y$|^yes$|^n$|^no$/i
    q.responses[:not_valid] = prompt
  end
  (answer =~ /^y$|^yes$/i) == 0
end