Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Any formats can mean positional/unary numeral systems :)
Ruby

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
example
lib/integer
test
.gitignore
History.rdoc
LICENSE
Manifest.txt
README.rdoc
Rakefile

README.rdoc

Integer::Base

Description

Your format comes into positional numeral systems.

Feautures

  • easy build upper 36 basenumbers

  • use original syntax (0 1 2 -> 0 a b, etc)

Usage

  • setup

    require 'integer/base'
  • extend

    require 'integer/base/ext'
  • to_i

    my_chars = %w[0 a]
    'a'.to_i(my_chars) #=> 1
    'a0'.to_i(my_chars) #=> 2
    
    my_chars = ['0', *'A'..'I']
    'a'.to_i(my_chars) #=> 1
    'a0'.to_i(my_chars) #=> 10
    'aib'.to_i(my_chars) #=> 192
  • to_s

    192.to_s(my_chars) #=> 'aib'

Requirements

  • Ruby 1.9.2 or later

    target release versions

    • 1.9.3-p125

    • 1.9.2-p290

Installation

  • gem install integer-base

License

Copyright (C) 2011 Kenichi Kamiya

The MIT/X11 License (See the file LICENSE)

Something went wrong with that request. Please try again.