Module: NumberToIndianCurrency::CurrencyHelper

Defined in:
lib/number_to_indian_currency.rb

Instance Method Summary collapse

Instance Method Details

#number_to_indian_currency(number, html = true) ⇒ Object



36
37
38
39
# File 'lib/number_to_indian_currency.rb', line 36

def number_to_indian_currency(number, html=true)
  txt = html ? (:span, 'Rs.', :class => :WebRupee) : 'Rs.'
  "#{txt} #{number.to_s.gsub(/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/, "\\1,")}" 
end