https://github.com/RubyMoney/monetize
A library for converting various objects into `Money` objects.
https://github.com/RubyMoney/monetize
Keywords from Contributors
activerecord activejob mvc money exchange-rate rubygems rack crash-reporting rubocop static-code-analysis
Last synced: about 17 hours ago
JSON representation
Repository metadata
A library for converting various objects into `Money` objects.
- Host: GitHub
- URL: https://github.com/RubyMoney/monetize
- Owner: RubyMoney
- License: mit
- Created: 2013-12-24T21:34:38.000Z (almost 12 years ago)
- Default Branch: main
- Last Pushed: 2025-12-04T18:45:08.000Z (10 days ago)
- Last Synced: 2025-12-08T01:10:37.576Z (7 days ago)
- Language: Ruby
- Homepage:
- Size: 260 KB
- Stars: 441
- Watchers: 18
- Forks: 112
- Open Issues: 6
- Releases: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
README.md
Monetize
A library for converting various objects into Money objects.
Installation
Run:
bundle add monetize
Or install it yourself as:
$ gem install monetize
Usage
Monetize.parse("USD 100") == Money.new(100_00, "USD")
Monetize.parse("EUR 100") == Money.new(100_00, "EUR")
Monetize.parse("GBP 100") == Money.new(100_00, "GBP")
"100".to_money == Money.new(100_00, "USD")
Optionally, enable the ability to assume the currency from a passed symbol. Otherwise, currency symbols will be ignored, and USD used as the default currency:
Monetize.parse("£100") == Money.new(100_00, "USD")
Monetize.assume_from_symbol = true
Monetize.parse("£100") == Money.new(100_00, "GBP")
"€100".to_money == Money.new(100_00, "EUR")
Parsing can be improved where the input is not expected to contain fractional subunits.
To do this, set Monetize.expect_whole_subunits = true
Monetize.parse('EUR 10,000') == Money.new(100_00, "EUR")
Monetize.expect_whole_subunits = true
Monetize.parse('EUR 10,000') == Money.new(10_000_00, "EUR")
Why does this work? If we expect fractional subunits then the parser will treat a single
delimiter as a decimal marker if it matches the currency's decimal marker. But often
this is not the case - a European site will show $10.000 because that's the local format.
As a human, if this was a stock ticker we might expect fractional cents. If it's a retail price we know it's actually an incorrect thousands separator.
Monetize can also parse a list of values, returning an array-like object (Monetize::Collection):
Monetize.parse_collection("€80/$100") == [Money.new(80_00, "EUR"), Money.new(100_00, "USD")]
Monetize.parse_collection("€80, $100") == [Money.new(80_00, "EUR"), Money.new(100_00, "USD")]
# The #range? method detects the presence of a hyphen
Monetize.parse_collection("€80-$100").range? == true
Contributing
See CONTRIBUTING.md for details.
Owner metadata
- Name: RubyMoney
- Login: RubyMoney
- Email:
- Kind: organization
- Description:
- Website:
- Location:
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/351550?v=4
- Repositories: 7
- Last ynced at: 2024-03-25T20:47:10.970Z
- Profile URL: https://github.com/RubyMoney
GitHub Events
Total
- Issues event: 2
- Watch event: 15
- Issue comment event: 12
- Push event: 6
- Pull request review comment event: 4
- Pull request review event: 7
- Pull request event: 8
- Fork event: 4
- Create event: 3
Last Year
- Issues event: 2
- Watch event: 9
- Issue comment event: 12
- Push event: 6
- Pull request review comment event: 4
- Pull request review event: 7
- Pull request event: 8
- Fork event: 4
- Create event: 3
Committers metadata
Last synced: 9 days ago
Total Commits: 208
Total Committers: 59
Avg Commits per committer: 3.525
Development Distribution Score (DDS): 0.769
Commits in past year: 12
Committers in past year: 6
Avg Commits per committer in past year: 2.0
Development Distribution Score (DDS) in past year: 0.667
| Name | Commits | |
|---|---|---|
| Shane Emmons | s****e@e****o | 48 |
| Anthony Dmitriyev | a****m@g****m | 41 |
| Alvaro Redondo | a****o@r****e | 31 |
| Geremia Taglialatela | t****v@g****m | 5 |
| Anton Trushkevich | a****h@s****m | 4 |
| pranavbabu | 5****u | 4 |
| Ben Sheldon | b****n@g****m | 4 |
| Ville Lautanala | l****s@g****m | 3 |
| Tate Johnson | t****e@t****m | 3 |
| Szczepan Bułat | s****t@g****m | 3 |
| Damon Davison | d****n@a****t | 3 |
| Casper Thomsen | ct@c****m | 3 |
| Théophile Helleboid - chtitux | c****x@g****m | 2 |
| Nguyen Vu Nguyen | n****n@g****m | 2 |
| Mike Boone | m****e@b****t | 2 |
| Théophile Helleboid | t****d@c****m | 2 |
| Chris Nitsas | n****s@g****m | 2 |
| Julien ITARD | j****d@g****m | 2 |
| Justin Louie | 2****i | 2 |
| Langtian Lang | l****g@y****m | 2 |
| Mehdi Ahmadov | m****v@g****m | 2 |
| Antonio Facciolo | a****2 | 1 |
| Andreas Loupasakis | a****p@a****g | 1 |
| Amanda Wagener | a****a@a****m | 1 |
| Adrian Macneil | a****n@c****m | 1 |
| Karolis-Sakavicius | k****s@s****u | 1 |
| Mike Scott | m****t@s****m | 1 |
| Paul Baumgart | p****l@p****m | 1 |
| Roman Kapitonov | R****v@c****m | 1 |
| yukimurasawa | y****6@g****m | 1 |
| and 29 more... | ||
Committer domains:
- teamsnap.com: 1
- talkgoal.com: 1
- opensoul.org: 1
- myfave.com: 1
- dblock.org: 1
- spkdev.net: 1
- mochithings.com: 1
- szemafor.com: 1
- me.com: 1
- alexmuir.com: 1
- openmail.lerctk.com: 1
- urbanautomaton.com: 1
- sdrew.me: 1
- tjschuck.com: 1
- coherentsolutions.com: 1
- proxv.com: 1
- sqs.com: 1
- synergium.eu: 1
- coinbase.com: 1
- awagener.com: 1
- aloop.org: 1
- yammer-inc.com: 1
- captaintrain.com: 1
- boonedocks.net: 1
- clearhaus.com: 1
- allolex.net: 1
- tatey.com: 1
- softswiss.com: 1
- redondo.name: 1
- emmons.io: 1
Issue and Pull Request metadata
Last synced: 4 days ago
Total issues: 43
Total pull requests: 104
Average time to close issues: about 1 year
Average time to close pull requests: about 2 months
Total issue authors: 39
Total pull request authors: 39
Average comments per issue: 2.51
Average comments per pull request: 1.88
Merged pull request: 77
Bot issues: 0
Bot pull requests: 0
Past year issues: 2
Past year pull requests: 13
Past year average time to close issues: 15 days
Past year average time to close pull requests: 19 days
Past year issue authors: 2
Past year pull request authors: 7
Past year average comments per issue: 0.5
Past year average comments per pull request: 0.38
Past year merged pull request: 6
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- terencedignon (2)
- seankap07 (2)
- FunkyloverOne (2)
- tagliala (2)
- smudge (1)
- mpoulsen (1)
- NGMarmaduke (1)
- imargonis (1)
- shamas- (1)
- lilith (1)
- ricobl (1)
- BKDruby (1)
- trushkevich (1)
- HaleTom (1)
- penghouho (1)
Top Pull Request Authors
- antstorm (30)
- semmons99 (11)
- tagliala (10)
- chtitux (3)
- sbulat (3)
- RubenIgnacio (3)
- lautis (2)
- kahshing96 (2)
- ct-clearhaus (2)
- shirts (2)
- thai-truong (2)
- rocwrxsti (2)
- nitsas (2)
- Albertserv (2)
- nitsujri (2)
Top Issue Labels
Top Pull Request Labels
Package metadata
- Total packages: 4
-
Total downloads:
- rubygems: 125,880,971 total
- Total docker downloads: 14,088,950
- Total dependent packages: 58 (may contain duplicates)
- Total dependent repositories: 4,726 (may contain duplicates)
- Total versions: 112
- Total maintainers: 6
gem.coop: monetize
A library for converting various objects into `Money` objects.
- Homepage: https://github.com/RubyMoney/monetize
- Documentation: http://www.rubydoc.info/gems/monetize/
- Licenses: MIT
- Latest release: 2.0.0 (published 3 days ago)
- Last Synced: 2025-12-12T15:01:28.403Z (2 days ago)
- Versions: 29
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 62,951,828 Total
- Docker Downloads: 7,044,475
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 0.393%
- Downloads: 0.442%
- Docker downloads count: 1.131%
- Maintainers (6)
rubygems.org: monetize
A library for converting various objects into `Money` objects.
- Homepage: https://github.com/RubyMoney/monetize
- Documentation: http://www.rubydoc.info/gems/monetize/
- Licenses: MIT
- Latest release: 2.0.0 (published 3 days ago)
- Last Synced: 2025-12-11T22:31:41.143Z (3 days ago)
- Versions: 29
- Dependent Packages: 58
- Dependent Repositories: 4,726
- Downloads: 62,929,143 Total
- Docker Downloads: 7,044,475
-
Rankings:
- Downloads: 0.429%
- Dependent repos count: 0.459%
- Dependent packages count: 0.472%
- Average: 1.399%
- Docker downloads count: 1.64%
- Forks count: 2.536%
- Stargazers count: 2.859%
- Maintainers (6)
proxy.golang.org: github.com/rubymoney/monetize
- Homepage:
- Documentation: https://pkg.go.dev/github.com/rubymoney/monetize#section-documentation
- Licenses: mit
- Latest release: v1.13.0 (published almost 2 years ago)
- Last Synced: 2025-12-10T22:04:02.751Z (4 days ago)
- Versions: 27
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent packages count: 6.999%
- Average: 8.173%
- Dependent repos count: 9.346%
proxy.golang.org: github.com/RubyMoney/monetize
- Homepage:
- Documentation: https://pkg.go.dev/github.com/RubyMoney/monetize#section-documentation
- Licenses: mit
- Latest release: v1.13.0 (published almost 2 years ago)
- Last Synced: 2025-12-10T22:04:06.311Z (4 days ago)
- Versions: 27
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent packages count: 6.999%
- Average: 8.173%
- Dependent repos count: 9.346%
Dependencies
- i18n ~> 0.9
- json ~> 1.8.3
- json >= 0
- term-ansicolor ~> 1.3.0
- tins ~> 1.6.0
- bundler >= 0 development
- rake ~> 10.2 development
- rspec ~> 3.0 development
- money ~> 6.12
- actions/checkout v2 composite
- ruby/setup-ruby v1 composite
Score: 28.937068852863906