Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A ruby gem to encode/decode integers to and from base31
Ruby
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.document
.gitignore
.project
Gemfile
Gemfile.lock
LICENSE.txt
README
README.rdoc
Rakefile
VERSION
base31_encoder.gemspec

README.rdoc

base31_encoder

This is a small class library, used to display base 10 integers as an easy to read base31 number. This was library was created as part of a bigger project, where a human-readable uid was required.

Requirements for the encoder:

  1. The encoded string should be easy for a human to read and memorise, if required (ie. not too long and alpha-numeric).

  2. The encoded should not randomly generate a string that would be considered profanity (hence the exclusion of all vowel characters from the alpha-numeric range).

Sample usage:

#Convert base10 integer to base31 guid string: base10 = 12345 obj = Base31encoder.new(base_length=5) base31 = obj.int_to_base31($base10num) # base31 = “00DV7”

#Convert base31 string to base10 integer base31 = “00DV7” obj = Base31encoder.new(base_length=5) base10 = obj.base31str_to_int(base31) # base10 = 12345

Contributing to base31_encoder

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet

  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it

  • Fork the project

  • Start a feature/bugfix branch

  • Commit and push until you are happy with your contribution

  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright

Copyright © 2011 foomip. See LICENSE.txt for further details.

Something went wrong with that request. Please try again.