Shards

Shards - Little Slivers of Ruby Goodness

(Miscellaneous Ruby Libraries)

archive-tar-external
attempt
crypt-fog
crypt-rot13
dbi-dbrc
facade
file-find
file-temp
getopt
Author: Daniel J. Berger
Here you will find documentation for the libraries of the shards project.

Shards are a miscellaneous collection of Ruby libraries that the author put under a common project. The libraries range from additional methods for the core File class, to ports of various Perl modules (more or less) to libraries designed to replace the ones that ship with Ruby's standard library.

Click on the library name on the left to go to the documentation for that library. In some cases the documentation is generic. In others it's platform specific.

Below is a quick synopsis of each library.

archive-tar-external

The archive-tar-external library provides an handy interface for making external tar + zip/bzip2/gzip calls.

Works on all platforms that have a 'tar' command line program, along with at least one compression program.

Installation: gem install archive-tar-external

attempt

The attempt library is a thin wrapper for begin + rescue + sleep + retry.

It's a handy shortcut for dealing with situations where the the host/server you're connecting to might flake out temporarily, and you would rather try again rather than have your program terminate immediately.

Installation: gem install attempt

crypt-fog

The crypt-fog library is a simple string encryption library. It's better than Rot13 encryption, but not as good as, say, Blowfish. :)

Installation: gem install crypt-fog

crypt-rot13

It's everyone's favorite encryption scheme! Also good for generating the 'Caesar Cipher'! This is a very simple string rotation/encryption library.

But, it's cool because, you know, Julius Caesar used character rotation as a means of encryption. You want to be like Julius Caesar, don't you? Of course you do!

Installation: gem install crypt-rot13

dbi-dbrc

The dbi-dbrc library is a simple database configuration file interface. In addition to storing logins and passwords, you can store information such as maximum reconnect attempts and timeout values, which you would then later use in your DBI calls.

You can also just use it as a simple password manager if you prefer. Just keep in mind that this library does NOT do any sort of implicit encryption.

Installation: gem install dbi-dbrc

facade

The facade library provides an easy way to implement the Facade pattern in Ruby.

In short, it allows you to mixin singleton methods from other classes as though they were instance methods of the current class.

Installation: gem install facade

file-find

The file-find library is a Ruby interface for finding files. It provides a much richer set of options than Ruby's 'find' library does.

It was modeled somewhat on the 'find' command line tool, in terms of the options that it supports.

Installation: gem install file-find

file-temp

The file-temp library is an alternative to the Tempfile library that comes as part of the Ruby standard library.

This library uses your system's native tmpfile(), tmpfile_s() or mkstemp() functions instead of trying to handle race conditions manually via pure Ruby.

In addition, the FileTemp class is a subclass of File (Ruby's Tempfile is not), so you have a familiar sensible interface with all the behavior you would expect of an IO instance. Except for that bit where the file is temporary, of course.

Installation: gem install file-temp

getopt

The getopt library is yet another command line parser that was born out of dissatisfaction with the command line parsers that come with Ruby's standard library. This library includes two types of command line parsers.

The first, Getopt::Std, is based on the Perl module of the same name, and is useful when all you want are a few simple options.

The second, Getopt::Long, combines features from both the GetoptLong library (from Ruby's standard library) and the Perl module of the same name.

Installation: gem install getopt

Contribute
Visit the Forum
File a Bug
Make a Feature Request