# File lib/annoy.rb, line 219 219: def Annoy.get_user_input(msg, echo=nil, period=nil) 220: return unless STDIN.tty? # Only ask a question if there's a human 221: return if Annoy.skip? 222: response = nil 223: begin 224: success = Timeout::timeout(period || @@period) do 225: highline = HighLine.new 226: response = highline.ask(msg) { |q| 227: unless echo.nil? 228: q.overwrite = true # Erase the question afterwards 229: q.echo = echo # Don't display response 230: end 231: q.whitespace = :strip # Remove whitespace from the response 232: } 233: end 234: rescue Timeout::Error => ex 235: puts $/, "Times up!" 236: end 237: response 238: end