Class: Base32::Crockford

Inherits:
Base
  • Object
show all
Defined in:
lib/base32-alphabets/crockford.rb

Constant Summary collapse

ALPHABET =
%w[ 0 1 2 3 4 5 6 7
8 9 a b c d e f
g h j k m n p q
r s t v w x y z]
NUMBER =

rename INTEGER /INT - why? why not??

{    ## rename INTEGER /INT - why? why not??
  '0' => 0, 'o' => 0, 'O'=> 0,
  '1' => 1, 'l' => 1, 'L'=> 1, 'i'=> 1, 'I' => 1,
  '2' => 2,
  '3' => 3,
  '4' => 4,
  '5' => 5,
  '6' => 6,
  '7' => 7,
  '8' => 8,
  '9' => 9,
  'a' => 10, 'A' => 10,
  'b' => 11, 'B' => 11,
  'c' => 12, 'C' => 12,
  'd' => 13, 'D' => 13,
  'e' => 14, 'E' => 14,
  'f' => 15, 'F' => 15,
  'g' => 16, 'G' => 16,
  'h' => 17, 'H' => 17,
  'j' => 18, 'J' => 18,
  'k' => 19, 'K' => 19,
  'm' => 20, 'M' => 20,
  'n' => 21, 'N' => 21,
  'p' => 22, 'P' => 22,
  'q' => 23, 'Q' => 23,
  'r' => 24, 'R' => 24,
  's' => 25, 'S' => 25,
  't' => 26, 'T' => 26,
  'v' => 27, 'V' => 27,
  'w' => 28, 'W' => 28,
  'x' => 29, 'X' => 29,
  'y' => 30, 'Y' => 30,
  'z' => 31, 'Z' => 31
}
BINARY =

simple hash map (helper) for conversion to binary string

build_binary( ALPHABET )
BIN =

add shortcuts (convenience) aliases

BINARY
NUM =
NUMBER

Class Method Summary collapse

Methods inherited from Base

build_binary, fmt

Class Method Details

.decode(str) ⇒ Object



54
# File 'lib/base32-alphabets/crockford.rb', line 54

def self.decode( str ) super( str, klass: self ); end

.encode(num) ⇒ Object



16
# File 'lib/base32-alphabets/crockford.rb', line 16

def self.encode( num ) super( num, klass: self ); end