module NumberToIndianCurrency::CurrencyHelper
Public Instance Methods
number_to_indian_currency(number, options={})
click to toggle source
# File lib/number_to_indian_currency/currency_helper.rb, line 3 def number_to_indian_currency(number, options={}) web_rupee = options.fetch(:web_rupee, false) text = options.fetch(:text, 'Rs.') text = content_tag(:span, text, class: :WebRupee) if web_rupee formatted_number = number.to_s.gsub(/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/, "\\1,") return [text, formatted_number].join end