P4Ruby is an extension to the Ruby programming language that allows you to run Perforce commands from within Ruby scripts, and get the results in a Ruby-friendly format.
P4Ruby is designed to work in a Ruby-like way as far as possible. It has support for Ruby exceptions to make error handling as easy as possible and even distinguishes between errors and warnings - allowing you to ignore warnings whilst still trapping errors.
If you're new to P4Ruby, the best place to start is with the documentation for the P4 class. This is the main Ruby class defined by P4Ruby.
Sign up to the p4ruby mailing list and post your question to the list. Alternatively, you can contact the author Tony Smith directly for support. I'll respond as quickly as I'm able. All feedback and suggestions are most welcome.
Building P4Ruby requires version 2001.1 or later of the Perforce API and a C++ compiler - ideally the same C++ compiler used to build the Perforce API.
Running P4Ruby requires a 99.2 or later Perforce server to be of any real use to you. Earlier servers did not support tagged output in the same way.
The more recent your server, the better as tagged output support is continually being improved.