You can do this:
A1. $ gvim xxx.rb A2. Mark the area you want to copy. A3. Menu > Edit A4. Copy A5. $ irb A6. Paste at irb(main):001:0> A7. Enter A8. You have the program in irb now.