Method: Humanize::Id#humanize

Defined in:
lib/humanize/locales/id.rb

#humanize(number) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/humanize/locales/id.rb', line 5

def humanize(number)
  iteration = 0
  parts = []
  until number.zero?
    number, remainder = number.divmod(1000)
    unless remainder.zero?
      add_grouping(parts, iteration)

      parts << SUB_ONE_GROUPING[remainder]
    end

    iteration += 1
  end

  correct_one_thousand(parts)
end