Sha256: 592f7b983c413b3df856586839697a043113f62990b0347d95c6c5a4af131794

Contents?: true

Size: 224 Bytes

Versions: 1

Compression:

Stored size: 224 Bytes

Contents

class Numeric

  Alpha26 = ("a".."z").to_a

  def to_s26
    return "" if self < 1

    s, q = "", self
    loop do
      q, r = (q - 1).divmod(26)
      s.prepend(Alpha26[r])
      break if q.zero?
    end
    s
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
creative_rails_utilities-0.1.0 lib/creative_rails_utilities/numeric.rb