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

Version Path
humanize-3.0.0 lib/humanize/locales/jp.rb
humanize-2.5.1 lib/humanize/locales/jp.rb
humanize-2.5.0 lib/humanize/locales/jp.rb
humanize-2.4.3 lib/humanize/locales/jp.rb
humanize-2.4.2 lib/humanize/locales/jp.rb
humanize-2.4.1 lib/humanize/locales/jp.rb