Sha256: 0eae0e2ec2c31378b5ef3f0b643adf1dc70236db80c99dda196f2dd727df4f6a
Contents?: true
Size: 1002 Bytes
Versions: 76
Compression:
Stored size: 1002 Bytes
Contents
require 'timeout' module Eco module API module Common module Session module Helpers module PromptUser def prompt_user(question, default:, explanation: "", timeout: nil) response = if config.run_mode_remote? default else puts explanation print "#{question} " if timeout begin Timeout::timeout(timeout) { STDIN.gets.chop } rescue Timeout::Error default end else STDIN.gets.chop end end return response unless block_given? yield(response) end end end end end end end
Version data entries
76 entries across 76 versions & 1 rubygems