Pause the execution of the code on keypress and continue on keypress

Hey guys,

I’m Alex a newcomer to ruby language and I really enjoy using it so far.
I’m working as a test engineer for 2 months now. I started to create a
test automation suite for my company using Ruby with Watir gem.
I could acquire all the information needed to do this so far by only
reading, but now I encountered a problem that I couldn’t solve by
searching & reading.
Here is the thing: I’d like to include a feature in my scripts that will
let the user pause the execution of the script by pressing a button (for
example F7) and also continue from where the execution stopped by
pressing another one. I’m looking for an example code if possible.
Thanks in Advance

Best Regards,
Alex