1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-18 20:59:39 +02:00

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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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