Sha256: 272950543469fa1d5821cf4c9a58f5bef67a688d8604da4abbd729518617b0ed
Contents?: true
Size: 546 Bytes
Versions: 6
Compression:
Stored size: 546 Bytes
Contents
require_relative 'constants/jp' module Humanize class Jp def humanize(number) iteration = 0 parts = [] until number.zero? number, remainder = number.divmod(10_000) unless remainder.zero? add_grouping(parts, iteration) parts << SUB_ONE_GROUPING[remainder] end iteration += 1 end parts end private def add_grouping(parts, iteration) grouping = LOTS[iteration] return unless grouping parts << grouping.to_s end end end
Version data entries
6 entries across 6 versions & 1 rubygems