Sha256: 1cc01fea2e49a3c9c3496102a31e467ac0c3a903a3cb20c37ac4360dfe832e67
Contents?: true
Size: 995 Bytes
Versions: 23
Compression:
Stored size: 995 Bytes
Contents
module Eco module API module Common module Session module Helpers module PromptUser # Prompts user for input with option for default on timeout. def prompt_user(question, default:, explanation: "", timeout: nil) require 'timeout' 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
23 entries across 23 versions & 1 rubygems