https://github.com/danielpclark/basecustom
Define any base conversion with any identifier for each value. Let the fun begin!
https://github.com/danielpclark/basecustom
base-conversion numeric ruby
Last synced: 12 months ago
JSON representation
Define any base conversion with any identifier for each value. Let the fun begin!
- Host: GitHub
- URL: https://github.com/danielpclark/basecustom
- Owner: danielpclark
- License: mit
- Created: 2012-10-30T23:33:53.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2016-04-29T02:56:35.000Z (almost 10 years ago)
- Last Synced: 2025-02-02T16:25:17.990Z (about 1 year ago)
- Topics: base-conversion, numeric, ruby
- Language: Ruby
- Size: 24.4 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# BaseCustom
by Daniel P. Clark
[](http://badge.fury.io/rb/basecustom)
[](https://travis-ci.org/danielpclark/BaseCustom)
Inspired by:
* base62 by "JT Zemp" and contributors "Saadiq Rodgers-King", "Derrick Camerino"
**Description**
* Define any base conversion with any identifier for each value.
require "basecustom"
base2 = BaseCustom.new('01')
base2.base('00001')
=> 1
base2.base('100110101')
=> 309
base2.base(340)
=> "101010100"
base2.base(0xF45)
=> "111101000101"
baseABC = BaseCustom.new('ABC')
baseABC.base('ABC')
=> 5
baseABC.base(123)
=> "BBBCA"
# Usage Video
[](http://www.youtube.com/embed/b7TdvicxIrs)
# Version History
Version 1.0.2
* Cleaned up gemspec.
Version 1.0.1
* Enabled use of special characters like newline (\n) or tab (\t) to be counted
as acceptable numeric characters. These characters can now also be printed with
expected behavior.
Version 1.0.0
* Bump version number. Gem has proven ready as a version 1 release.
Version 0.1.8
* Changed .all() to join by delimiter
Version 0.1.7
* Added features .length() and .all()
Version 0.1.6
* Fixed 0 as 0 bug.
Version 0.1.5
* Added jmchambers' debug from jtzemp/base62 to avoid infinite loop in Rails 3.0.7
Version 0.1.4
* My father suggested delimiter splitting on String initialization made more sense.
* Test-Unit assertions fixed/updated.
Version 0.1.3
* Fixed multicharacter numbering units
* Added delimiter for multicharacter numbering units
* Safe base type creation. Each situation checked for and proper error messages.
Version 0.1.2
* Added unique to string init declaration
* Added unique to array as well as checking that all array elements are strings
Version 0.1.1
* Flatten array's on input initialization
Version 0.1.0
* Complete Release