Sha256: 83fe6978f5044bc70e6c55bc9240a66d2800a7dbb05dfc30fe81b89d10eaa2f0
Contents?: true
Size: 484 Bytes
Versions: 9
Compression:
Stored size: 484 Bytes
Contents
module Kernel module_function # Very simple convenience method to get a console reply. # # ask "Are you happy?", "Yn" # # On the command line one would see. # # $ Are you happy? [Yn] # # Responding: # # $ Are you happy? [Yn] Y <ENTER> # # The ask method would return "Y". def ask(question, answers=nil) $stdout << "#{question}" $stdout << " [#{answers}] " if answers until inp = $stdin.gets ; sleep 1 ; end inp.strip end end
Version data entries
9 entries across 9 versions & 2 rubygems