Class: NumberWords::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/number_words.rb

Instance Method Summary collapse

Instance Method Details

#split_by_thousands(n) ⇒ Object



15
16
17
18
19
# File 'lib/number_words.rb', line 15

def split_by_thousands n
  sub = [n % 1000]
  sup = n / 1000
  sub + (sup > 0 ? split_by_thousands(sup) : [])
end