Enhance currency selector to list 'All Others' after 'Popular' (#610)

This commit is contained in:
Mike
2024-04-10 17:47:58 +03:00
committed by GitHub
parent b5c56f7775
commit b812b6d8c9
3 changed files with 35 additions and 1 deletions

View File

@@ -26,6 +26,10 @@ class Money::Currency
@all ||= YAML.load_file(CURRENCIES_FILE_PATH)
end
def all_instances
all.values.map { |currency_data| new(currency_data["iso_code"]) }
end
def popular
all.values.sort_by { |currency| currency["priority"] }.first(12).map { |currency_data| new(currency_data["iso_code"]) }
end