Sha256: 3358643e442f136e4b64394b2a294c5956806584717078e3ffb454da2a834923
Contents?: true
Size: 520 Bytes
Versions: 19
Compression:
Stored size: 520 Bytes
Contents
module Vpsb module AskSupport def ask(&block) yield if block STDIN.gets.chomp end def ask_to_confirm(question, &block) answer = ask { puts "#{question} y[es]/n[o]?" } cond = (answer[0].to_s.downcase == 'y') yield cond if block cond end def ask_loop(condition = nil, &block) condition ||= proc { |res| !res.strip.empty? } begin yield if block res = STDIN.gets.chomp end until condition.call(res) res end end end
Version data entries
19 entries across 19 versions & 1 rubygems