Project

to_insane

0.0
No commit activity in last 3 years
No release in over 3 years
ToInsane allows you to convert strings and integers to a Base larger than the default max of 36 and use a custom character set
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

To Insane!¶ ↑

A small String and Integer extender that allow you to use a base larger than 36 and use custom character sets for base conversion. Default max of 67. Also include url safe integer conversion.

Donate¶ ↑

I did not really make this library I just modified it off this guy. Donate your money to him.

If you find this library useful, please consider a donation to show your support!

www.paypal.com/cgi-bin/webscr?cmd=_send-money

Paypal address: dougal.s@gmail.com

Install¶ ↑

$ sudo gem install to_insane

Usage¶ ↑

require 'rubygems'
require 'to_insane'

# Int to insane (Default: Base 58)
1337.to_insane # => n3

# From insane to Int (Default: Base 58)
'A2Ph'.from_insane # => 7033619

# Different Bases
'A2Ph'.from_insane(50) # => 4507467
4507467.to_insane(50)  # => 'A2Ph'

# Different Character Sets
'A2Ph'.from_insane(:max,'A2Ph') # => 27
27.to_insane(:max,'A2Ph')

# Other Inputs
# :url_safe uses the max number characters that are RFC URL non reserved
# :max uses the max number of characters for given character set. Default character set is 87
27.to_insane(:url_safe) 
27.to_insane(:max)

Info¶ ↑

Default Character set. I choose not to use any slashes or quotes of any sort to prevent breaking

INSANECHARACTERS = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ-._~+[]|$!*(),{}^<>#%;?:@&='

Credits¶ ↑

Ryan Ong - ryangong.net

Douglas F Shearer - douglasfshearer.com

Developed for and with CarZen.com