Class: HumanNumber::Formatters::Currency

Inherits:
Object
  • Object
show all
Extended by:
ActionView::Helpers::NumberHelper
Defined in:
lib/human_number/formatters/currency.rb

Class Method Summary collapse

Class Method Details

.format(formatted_number, currency_code:, locale:) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Internal formatter for applying currency symbols to pre-formatted number strings. All parameters are required - use HumanNumber.currency/human_currency for user-friendly interface.

Parameters:

  • formatted_number (String) —

    Pre-formatted number string

  • currency_code (String) —

    ISO 4217 currency code

  • locale (Symbol, String) —

    Locale for currency symbol and format rules

Returns:

  • (String) —

    Formatted currency string with symbol and proper placement



20
21
22
23
24
25
# File 'lib/human_number/formatters/currency.rb', line 20

def format(formatted_number, currency_code:, locale:)
  locale = locale.to_sym

  # Apply currency formatting using user's locale to determine native vs non-native display
  apply_currency_formatting(formatted_number, currency_code, locale)
end