# File lib/annoy.rb, line 182
182:   def Annoy.pose_question(msg, regexp, writer=STDOUT, period=nil)
183:     return true unless STDIN.tty? # Only ask a question if there's a human
184:     return true if Annoy.skip?
185:     return true if writer.nil?
186:     begin
187:       success = Timeout::timeout(period || @@period) do
188:         regexp &&= Regexp.new regexp
189:         highline = HighLine.new 
190:         response = highline.ask(msg) { |q| 
191:           q.echo = '*'             # Don't display response
192:           q.overwrite = true       # Erase the question afterwards
193:           q.whitespace = :strip    # Remove whitespace from the response
194:         }
195:         regexp.match(response)
196:       end
197:     rescue Timeout::Error => ex
198:       writer.puts $/, "Times up!"
199:       false
200:     end
201:   end