Initial implementation and spec tests.

There are some gems that do this if you want to remove it from your code.