Sha256: 82022f3082ea077ef5304bd2816e56bb03c79efc847b75951a7755a40e5873ca
Contents?: true
Size: 829 Bytes
Versions: 6
Compression:
Stored size: 829 Bytes
Contents
# = consoleutils.rb module ConsoleUtils module_function # Convenient method to get simple console reply. def ask( question, answers=nil ) print "#{question}" print " [#{answers}] " if answers until inp = $stdin.gets[0,1] ; sleep 1 ; end ; puts inp end # Convenience method for puts. Use this instead of # puts when the output should be supressed if the # global $QUIET option is set. def say( statement ) puts statement unless $QUIET end alias :tell :say # TODO deprecate # def password(forwhat=nil) if forwhat ask("password for #{forwhat}: ") else ask("password: ") end end # def password_cached(forwhat=nil) if forwhat @password ||= ask("password for #{forwhat}: ") else @password ||= ask("password: ") end end end
Version data entries
6 entries across 6 versions & 1 rubygems