Sha256: 471016a948d25ddff259255c49ff76b0294d8a05cfc8b5e5a30dc06a4cc6228c
Contents?: true
Size: 502 Bytes
Versions: 6
Compression:
Stored size: 502 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 $stdout.flush until inp = $stdin.gets ; sleep 1 ; end inp.strip end end
Version data entries
6 entries across 6 versions & 1 rubygems