base62
Get Version
0.1.0What
The base62 gem monkeypatches Integer and String. It creates an Integer#base62_encode instance method to encode integers into a string with this set of characters: 0-9 + A-Z + a-z. It also creates a String#base62_decode method to reverse the encoded string back into an integer.
I created this gem library to be the basis of a URL minifying product and service that I’ll release and host soon.
Installing
sudo gem install base62
The basics
puts 123456789.base62_encode # => "8M0kX" puts "8M0kX".base62_decode # => 123456789
Developer’s Site
http://geekjacking.com/base62_gem
How to submit patches
Read the 8 steps for fixing other people’s code. It’s good, but doesn’t have instructions for GitHub, so come back here after you’re done and read on.
If you want to submit patches (or check out the code to see how to change from base 10 to base 62) the project code is on GitHub. Here are good instructions for submitting patches through GitHub: http://github.com/guides/fork-a-project-and-submit-your-modifications
git clone git://github.com/jtzemp/base62.git
Build and test instructions
cd base62 rake test rake install_gem
License
This code is free to use under the terms of the MIT license.
Contact
Comments are welcome. I’d love to know if you’re using it just out of curiosity. Send an email to JT dot Zemp at the domain thriveis.com, or go to http://geekjacking.com/base62_gem and leave a comment there.
JT Zemp (JT Zemp on Twitter), 6th October 2008
Theme extended from Paul Battley