Ramsey's Common Library version 0.0.5

This is simply a collection of Ruby modules that perform useful tasks. There are methods that do simple things like check permissions on files and directories, create and manipulate timestamps and authentication tokens, and so on. There are a couple of interesting modules that do interesting things like RELAXNG schema validation of XML files and an interactive command shell with history (with big props to the GNU Readline library).

Briefly, the modules and their respective methods are:

Base#initialize Base#dump Base#create Base#modify Base#update_modify Base#access Base#update_access

Perms#check_dir Perms#check_dir_r Perms#check_dir_w Perms#check_dir_rw Perms#check_file Perms#check_file_r Perms#check_file_w Perms#check_file_rw Perms#check_owned

Shell#initialize Shell#register Shell#unregister Shell#run Shell#history


Timestamp#new Timestamp#create Timestamp#modify Timestamp#access Timestamp#update_create Timestamp#update_modify Timestamp#update Timestamp#dump

Token#initialize Token#authenticate

URL#encode URL#decode URL#encoded?

XML#preprocess XML#validate


require 'rubygems' require 'rcl'


When you run the example programs, do it like so:

ruby examples/shell.rb

Use these example programs to see how you might use and otherwise integrate RCL functionality into your own programs.


I added a Rakefile and a gem spec. To build the gem, just type:

rake gem

To install the gem, just type:

sudo gem install rcl-0.0.5.gem


I haven't tested this code with YARV, so YMMV.

A summary of the international standard date and time notation www.cl.cam.ac.uk/~mgk25/iso-time.html

REXML support for RELAXNG document validation is incomplete and buggy. The XML::preprocess method solves a particularly thorny issue which causes REXML::RELAXNG to fail in the presence of whitespace due to formatting. Given a pathname, this function will remove leading and trailing whitespace from individual lines. The processed document will be returned to the caller for further processing.

External Code and Acknowledgements

Occasionally I run across interesting snippets of Ruby code on the 'net that don't seem to have a reliable home. They could be orphaned projects or just a random post on a mailing list somewhere. If I find the code to be useful, I will add it to the lib/ext directory. Not wishing to steal anyone's thunder, here are acknowledgements for the current contents of the lib/ext directory:

I do not claim copyright or ownership of these included bits of code. I am merely including them in one place because I use them all the time and wanted to make them more available to my own projects.