Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update README with customising currency symbol example #1102

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,12 @@ m = Money.from_cents('123', :gbp) # => #<Money fractional:123 currency:GBP>
m.format(symbol: m.currency.to_s + ' ') # => "GBP 1.23"
```

If you would like to customise currency symbols (e.g to avoid ambiguous between currencies), you can set custom symbol for specific currency as following

```ruby
Money::Currency.table[hkd][:symbol] = 'HK$'
ptadros marked this conversation as resolved.
Show resolved Hide resolved
```

## Rounding

By default, `Money` objects are rounded to the nearest cent and the additional precision is not preserved:
Expand Down