Skip to content

Conversation

@RubenIgnacio
Copy link

@RubenIgnacio RubenIgnacio commented Jan 25, 2025

Update: I recently noticed that parsing by ISO code (e.g., PEN10) has been fixed in the main branch. Therefore, this PR now focuses strictly on symbol detection (e.g., S/10), which still defaults to USD.

Expected behavior:

Monetize.parse('S/10') # <Money fractional:1000 currency:PEN>

Current behavior:

Monetize.parse('S/10') # <Money fractional:1000 currency:USD>

Proposed Solution

I implemented a manual registration strategy via register_currency_symbol.

Why not auto-load all symbols?
I discarded the initial proposal (auto-loading from Money::Currency.table) because:

  1. Conflicts: Many symbols clash with decimal marks or suffixes (e.g., "K").
  2. Inefficiency: Trying to list and "ignore" every problematic symbol proved to be laborious and hard to maintain.
  3. Control: Since ISO codes are already loaded, it is more efficient to explicitly register only the symbols needed rather than loading the entire table with potential edge cases.

Usage:

Monetize.register_currency_symbol("S/", "PEN")

Monetize.parse("S/19.90") # <Money fractional:1990 currency:PEN>

@semmons99
Copy link
Member

we are having an issue with CI being automatically run. if someone figures it out, or we get to it ourselves, we can merge this (and all other PRs) right away.

@RubenIgnacio
Copy link
Author

what's the issue with the CI? maybe I can help

@semmons99
Copy link
Member

the workflows all stopped being detected. no tests are running across any repo

@RubenIgnacio RubenIgnacio force-pushed the improve-currency-symbol-detection branch from 5cddd04 to 014c5c9 Compare April 28, 2025 17:25
@RubenIgnacio
Copy link
Author

i just did a test and the workflow ran okay. i understand that for PRs coming from forks for the first time, it requires reviewer approval before running workflow tests. could that be the issue you're encountering, or do you have another workflow problem?

@semmons99
Copy link
Member

semmons99 commented Apr 28, 2025 via email

@RubenIgnacio
Copy link
Author

sure, I can take a look

@semmons99
Copy link
Member

@RubenIgnacio you are now an owner, though I think I may have fixed them...

@RubenIgnacio
Copy link
Author

thanks for the access. did you find the problem? we could try creating a new branch, setting up the workflow there, and sending a PR with any change to test, so we don't affect main. so far, I think it could be a GH problem, because as you mentioned, the tests are failing in all repos, and I haven't found anything strange in the config.

@semmons99
Copy link
Member

semmons99 commented Apr 30, 2025 via email

@RubenIgnacio
Copy link
Author

@semmons99 Hi, I tested in another branch with a friend and the CI works. I think now we just need to be careful if it happens again.

@RubenIgnacio RubenIgnacio force-pushed the improve-currency-symbol-detection branch from 014c5c9 to 9d48c33 Compare August 12, 2025 02:58
@RubenIgnacio RubenIgnacio force-pushed the improve-currency-symbol-detection branch from 4f532ba to 516ad2d Compare January 18, 2026 00:12
@RubenIgnacio RubenIgnacio force-pushed the improve-currency-symbol-detection branch from 516ad2d to 28eaceb Compare January 18, 2026 00:22
@RubenIgnacio RubenIgnacio force-pushed the improve-currency-symbol-detection branch from 28eaceb to 96ac50c Compare January 18, 2026 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants