I wrote a little tool called [Pry](
https://github.com/banister/pry/) to help me in my game development.
It effectively opens up an IRB session on an object, letting you play with your runtime state, examine or modify it, and then, on typing 'exit' return you to your game.
Useful for debugging or implementing a quake-style console for your game.
Install the gem:
gem install pry
require it:
require 'pry'
And try putting this somewhere in your update method:
Pry.into(self) if button_down?(Gosu::KbP)
Read the documentation here:
https://github.com/banister/pry/