Sha256: df6e5b6d1751809ee4ccf990189ae9a2b0b9130673061b091fb41ad92d802f04
Contents?: true
Size: 390 Bytes
Versions: 6
Compression:
Stored size: 390 Bytes
Contents
require 'highline/import' module Prompt def Prompt.yesno(prompt = 'Continue?', default = false) a = '' s = default ? '[Y/n/s]' : '[y/N/s]' d = default ? 'y' : 'n' until %w[y n s].include? a a = ask("#{prompt} #{s} ") { |q| q.limit = 1; q.case = :downcase } a = d if a.length == 0 end if a == 'y'; true elsif a == 's'; 'skip' else false end end end
Version data entries
6 entries across 6 versions & 1 rubygems