Fixed up the Ruby implementation a bit

Fixed up a few things from @jay754's implementation in #10 

- Code is a bit more idiomatic Ruby.
- I've also turned it ino a gem.
- It's still following the old spec though.