There are a couple of ways of doing this depending on how you feel
The simplest option is to crate a class and put the file in your projects libs folder then just use it as you would any other class
If you want to share this functionality with others including other apps you may want to use it in then make a gem which sounds far more complicated than it is
check out this railscast on how to make a gem http://railscasts.com/episodes/245-new-gem-with-bundler it really is simple to do
using a module is another way and combining modules with classes is yet another way of namespacing the class so you don't get conflicts with names
Modules work much the same as a class. It's just a place holder to store methods that can then be included wherever you want it's kind of the equivalent of a java library and can not be created as a class. You can use a module to mix in class methods and instance methods into any other class just by including the file in whatever classes want that functionality. It's kinda like a neat work around for not having multiple inheritance
What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)