Permalink
Browse files

standard chars

  • Loading branch information...
1 parent 907e58a commit 49c781439a33850f1105921eaab5c594f6fe3bc9 @kachick committed May 3, 2012
Showing with 19 additions and 0 deletions.
  1. +19 −0 lib/integer/base/standard_chars.rb
@@ -0,0 +1,19 @@
+class Integer; module Base
+
+ STANDARD_CHARS = {}.tap {|standards|
+ 1.upto 10 do |n|
+ standards[n] = ('0'..((n - 1).to_s)).map(&:to_sym).freeze
+ end
+
+ alphabets = ('A'..'Z').map(&:to_sym)
+
+ 11.upto 36 do |n|
+ standards[n] = [
+ *standards[10], *alphabets.slice(0, n - 10)
+ ].freeze
+ end
+
+ standards[:BINARY] = standards[2]
+ }.freeze
+
+end; end

0 comments on commit 49c7814

Please sign in to comment.