Module: HumanCodes::Number
Instance Method Summary collapse
Instance Method Details
#human_code ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/human_codes.rb', line 16 def human_code return self if nil? || self <= 0 string = "" value = self until value == 0 mod = value % SAFE_BASE string << SAFE_CHARACTERS_AS_STRINGS[mod] value = value / SAFE_BASE end string.reverse end |