Module: BaseConvert::Configuration

Included in:
FromTo, Number
Defined in:
lib/base_convert/configuration.rb

Constant Summary collapse

GRAPH =
0.upto(255).map{|i| i.chr}.select{|c| c=~/[[:graph:]]/}.join.freeze
QGRAPH =
GRAPH.delete(%('"`)).freeze
WORD_ =
0.upto(255).map{|i| i.chr}.select{|c| c=~/\w/}.join.freeze
WORD =
WORD_.delete('_').freeze
INDEXa =
WORD.index('a')
AMBIGUOUS =
'B8G6I1l0OQDS5Z2'.freeze
UNAMBIGUOUS =
WORD.delete(AMBIGUOUS).freeze
BASE64 =
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
BASE =
{
  :graph       => GRAPH.length,
  :qgraph      => QGRAPH.length,
  :word_       => WORD_.length,
  :word        => WORD.length,
  :unambiguous => UNAMBIGUOUS.length,
  :base64      => 64,
  :b64         => 64,
  :hexadecimal => 16,
  :hex         => 16,
  :h           => 16,
  :decimal     => 10,
  :dec         => 10,
  :d           => 10,
  :octal       => 8,
  :oct         => 8,
  :o           => 8,
  :binary      => 2,
  :bin         => 2,
  :b           => 2,
}
DIGITS =
{
  :graph       => GRAPH,
  :g           => GRAPH,
  :qgraph      => QGRAPH,
  :q           => QGRAPH,
  :word_       => WORD_,
  :w_          => WORD_,
  :word        => WORD,
  :w           => WORD,
  :unambiguous => UNAMBIGUOUS,
  :u           => UNAMBIGUOUS,
  :base64      => BASE64,
  :b64         => BASE64,
}