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 crash-reporting rubygems rubocop rack static-code-analysis
Last synced: about 2 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 (about 12 years ago)
- Default Branch: main
- Last Pushed: 2026-02-04T15:21:40.000Z (about 1 month ago)
- Last Synced: 2026-02-22T13:57:49.249Z (16 days ago)
- Language: Ruby
- Homepage:
- Size: 259 KB
- Stars: 449
- Watchers: 18
- Forks: 114
- Open Issues: 4
- 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
- Delete event: 1
- Pull request event: 12
- Fork event: 5
- Issues event: 3
- Watch event: 17
- Issue comment event: 14
- Push event: 9
- Pull request review comment event: 9
- Pull request review event: 20
- Create event: 3
Last Year
- Delete event: 1
- Pull request event: 11
- Fork event: 4
- Issues event: 3
- Watch event: 6
- Issue comment event: 14
- Push event: 8
- Pull request review comment event: 9
- Pull request review event: 20
- Create event: 3
Committers metadata
Last synced: about 7 hours ago
Total Commits: 230
Total Committers: 62
Avg Commits per committer: 3.71
Development Distribution Score (DDS): 0.791
Commits in past year: 33
Committers in past year: 9
Avg Commits per committer in past year: 3.667
Development Distribution Score (DDS) in past year: 0.697
| Name | Commits | |
|---|---|---|
| Shane Emmons | s****e@e****o | 48 |
| Anthony Dmitriyev | a****m@g****m | 41 |
| Alvaro Redondo | a****o@r****e | 31 |
| Ruben Ignacio Guzman Zamora | r****z@g****m | 10 |
| Julia López | j****z@g****m | 8 |
| Geremia Taglialatela | t****v@g****m | 5 |
| pranavbabu | 5****u | 4 |
| Ben Sheldon | b****n@g****m | 4 |
| Anton Trushkevich | a****h@s****m | 4 |
| Ville Lautanala | l****s@g****m | 3 |
| Tate Johnson | t****e@t****m | 3 |
| Szczepan Bułat | s****t@g****m | 3 |
| Casper Thomsen | ct@c****m | 3 |
| Damon Davison | d****n@a****t | 3 |
| Sunny Ripert | s****y@s****g | 3 |
| Justin Louie | 2****i | 2 |
| Christian Schmidt | cs@r****k | 2 |
| Julien ITARD | j****d@g****m | 2 |
| Chris Nitsas | n****s@g****m | 2 |
| Théophile Helleboid | t****d@c****m | 2 |
| Langtian Lang | l****g@y****m | 2 |
| Mehdi Ahmadov | m****v@g****m | 2 |
| Mike Boone | m****e@b****t | 2 |
| Nguyen Vu Nguyen | n****n@g****m | 2 |
| Théophile Helleboid - chtitux | c****x@g****m | 2 |
| 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 |
| and 32 more... | ||
Committer domains:
- teamsnap.com: 1
- aloop.org: 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
- boonedocks.net: 1
- yammer-inc.com: 1
- captaintrain.com: 1
- relatel.dk: 1
- sunfox.org: 1
- allolex.net: 1
- clearhaus.com: 1
- tatey.com: 1
- softswiss.com: 1
- redondo.name: 1
- emmons.io: 1
Issue and Pull Request metadata
Last synced: 6 days ago
Total issues: 43
Total pull requests: 108
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: 41
Average comments per issue: 2.51
Average comments per pull request: 1.84
Merged pull request: 81
Bot issues: 0
Bot pull requests: 0
Past year issues: 2
Past year pull requests: 16
Past year average time to close issues: 15 days
Past year average time to close pull requests: 14 days
Past year issue authors: 2
Past year pull request authors: 9
Past year average comments per issue: 0.5
Past year average comments per pull request: 0.5
Past year merged pull request: 10
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)
- RubenIgnacio (5)
- sbulat (3)
- chtitux (3)
- JulienItard (2)
- nitsujri (2)
- pranavbabu (2)
- Albertserv (2)
- ct-clearhaus (2)
- nitsas (2)
- rocwrxsti (2)
- thai-truong (2)
- lautis (2)
Top Issue Labels
Top Pull Request Labels
Package metadata
- Total packages: 5
-
Total downloads:
- rubygems: 131,210,139 total
- Total docker downloads: 14,088,950
- Total dependent packages: 58 (may contain duplicates)
- Total dependent repositories: 4,726 (may contain duplicates)
- Total versions: 115
- 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 months ago)
- Last Synced: 2026-03-10T13:00:43.981Z (about 7 hours ago)
- Versions: 29
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 65,596,849 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 months ago)
- Last Synced: 2026-03-10T17:00:24.953Z (about 3 hours ago)
- Versions: 29
- Dependent Packages: 58
- Dependent Repositories: 4,726
- Downloads: 65,613,290 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: v2.0.0+incompatible (published 3 months ago)
- Last Synced: 2026-03-08T17:01:20.392Z (2 days ago)
- Versions: 28
- 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: v2.0.0+incompatible (published 3 months ago)
- Last Synced: 2026-03-08T17:00:46.872Z (2 days ago)
- Versions: 28
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent packages count: 6.999%
- Average: 8.173%
- Dependent repos count: 9.346%
guix: ruby-monetize
Convert various objects into Money objects
- Homepage: https://github.com/RubyMoney/monetize
- Documentation: https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/ruby-xyz.scm#n15875
- Licenses: expat
- Latest release: 1.11.0 (published 8 days ago)
- Last Synced: 2026-03-02T18:59:43.897Z (8 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
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: 29.037364803186957