Installing:
Although you can write Ruby code, this is a JRuby Gem. What does this mean? It means that the code execution environment is JRuby (Java+Ruby) and the Gem should be installed in the JRuby environment.
Lets install JRuby first:

Next, install the Buby Gem.

Basic example of running a script:

The options you see explained
jruby -S buby => runs the jruby environment leveraging the buby gem
-i => interactive, this means you can interact with Burp from the console.
-B => this is the location of your Burp jar file
-r => The script you'd like to run. This is an easy way to run the buby code you've created.
Finally, an example of sending a command to burp via the -i (interactive option). Here we produce an alert "Hello World".

Pre-command

Command

Post Command
Okay so that wraps up Part 1 of Buby Basics.
If you'd like some scripts to mess around before Part 2, you can find some scripts I put together Here.
~Happy Hacking
cktricky