Class: Integer

Inherits:
Object
  • Object
show all
Defined in:
lib/functional_support/core_ext/integer.rb

Instance Method Summary collapse

Instance Method Details

#to_alphabetObject

map this number to a lowercased alphabet letter 0-25 goes to a-z 26-52 goes to aa-zz, etc.



5
6
7
8
9
# File 'lib/functional_support/core_ext/integer.rb', line 5

def to_alphabet
  qm = divmod 26
  return _convert_to_letter qm.last if qm.first.abs.zero?
  return qm.first.to_alphabet + _convert_to_letter(qm.last)
end