Class: Float
- Inherits:
-
Object
- Object
- Float
- Defined in:
- lib/to_rupees.rb
Instance Method Summary collapse
Instance Method Details
#to_rupees ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/to_rupees.rb', line 50 def to_rupees in_words = [] v = divmod 1 in_words << v[0].to_i.to_rupees if v[1].to_f.nonzero? decimal_in_words = ToRupees::UnderHundred::UNDER_HUNDRED[("%.2f" % v[1].to_f).split('.').last.to_i] + " paisa" in_words = [in_words.last.to_s.gsub(' and ', ' ').split(' ').join(' ')] if in_words.size.nonzero? in_words << decimal_in_words end in_words.map(&:titleize).join(' and ') end |