Sha256: 416645ef60e2a7b41bce178d284d052ffc8ba8fd4cd822f59b47222054556459
Contents?: true
Size: 508 Bytes
Versions: 10
Compression:
Stored size: 508 Bytes
Contents
module Kernel module_function # Very simple convenience method to get user input # via the console. A prompt will be sent to $stdout, # if given, and the input taken from $stdin... # # 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(prompt=nil) $stdout << "#{prompt}" $stdout.flush $stdin.gets.chomp! end end
Version data entries
10 entries across 9 versions & 2 rubygems