remove constant warning in base62 file

This commit is contained in:
Régis Hanol 2018-01-19 19:52:42 +01:00
parent f674b9e86e
commit 24dcfc2db5
1 changed files with 3 additions and 3 deletions

View File

@ -1,9 +1,9 @@
# Modified version of: https://github.com/steventen/base62-rb
module Base62
KEYS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".freeze
KEYS_HASH = KEYS.each_char.with_index.inject({}) { |h, (k, v)| h[k] = v; h }
BASE = KEYS.length
KEYS ||= "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".freeze
KEYS_HASH ||= KEYS.each_char.with_index.to_h
BASE ||= KEYS.length
# Encodes base10 (decimal) number to base62 string.
def self.encode(num)