Skip to content

Commit

Permalink
Use :format to define per-currency formatting rules instead of :symbo…
Browse files Browse the repository at this point in the history
…l_first (RubyMoney#943)

* Add symbol_with_space key to currency config.
Add tests to test the spacing option.

* Make spacing part of currency rules when symbol procede the ammount

* Add :symbol_with_space attribute to currency config.
* Initialize symbol_with_space instance variable for currency object.
* Set '%u %n' format in rules if symbol_with_space value is true for a
  currency.
* Add test cases to cover the change.

* Use :format instead of :symbol_with_space in currency config.

* Add from format instace variable to currrency.
* Use currency format instance variable to format currency only if
  :symbol_position rule is not passed.
* :format rule takes the first priority when passed to rules.
  • Loading branch information
deepakhb2 authored Sep 15, 2020
1 parent a4d4db8 commit 966e5be
Show file tree
Hide file tree
Showing 7 changed files with 176 additions and 3 deletions.
4 changes: 4 additions & 0 deletions config/currency_backwards_compatible.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"subunit": "Sent",
"subunit_to_unit": 100,
"symbol_first": false,
"format": "%n %u",
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
Expand Down Expand Up @@ -39,6 +40,7 @@
"subunit": "Centas",
"subunit_to_unit": 100,
"symbol_first": false,
"format": "%n %u",
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
Expand Down Expand Up @@ -70,6 +72,7 @@
"subunit": "Khoums",
"subunit_to_unit": 5,
"symbol_first": false,
"format": "%n %u",
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
Expand Down Expand Up @@ -100,6 +103,7 @@
"subunit": "Tennesi",
"subunit_to_unit": 100,
"symbol_first": false,
"format": "%n %u",
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
Expand Down
Loading

0 comments on commit 966e5be

Please sign in to comment.