Releases: Shopify/money
v3.0.0
What's Changed
- arithmetic raises if unable to coerce to money by @elfassy in #314
- remove legacy_deprecation check for invalid strings by @TayKangSheng in #315
- to_money parse with Money.new when there is no thousand delimiter by @elfassy in #309
- convert currency by @elfassy in #311
- "".to_money does not generate a deprecation warning by @elfassy in #308
- init configuration for dependabot by @catwomey in #319
- Remove deprecation notice and raise error when strings cannot be parsed by bigdecimal by @TayKangSheng in #307
- default to the currency for thousand delimiter when unknown by @elfassy in #327
Breaking changes
For apps with the legacy_deprecation
option enabled ONLY (everyone else already has the after behaviour)
# before
your_own_object + Money.new(1)
# after
your_own_object.to_money + Money.new(1)
# before
"1.123".to_money #=> Money.new(1_123)
# after
"1.123".to_money #=> Money.new(1.12)
# before
Money.new("$1.00", "USD") #=> Money.new(0, "USD")
Money.new("1,000.00", "USD") #=> Money.new(0, "USD")
# After
Money.new("$1.00", "USD") #=> ArgumentError invalid value for BigDecimal(): "$1.00"
Money.new("1,000.00", "USD") #=> ArgumentError invalid value for BigDecimal(): "1,000.00"
For all apps
# before
Money::Parser::Fuzzy.parse("1.234", "USD") #=> Money.new(1_234, "USD")
Money::Parser::Fuzzy.parse("1.234", "JPY") #=> Money.new(1_234, "JPY")
# After
Money::Parser::Fuzzy.parse("1.234", "USD") #=> Money.new(1.23, "USD")
Money::Parser::Fuzzy.parse("1.234", "JPY") #=> Money.new(1, "JPY")
New Contributors
- @dependabot made their first contribution in #303
- @TayKangSheng made their first contribution in #315
- @catwomey made their first contribution in #319
Full Changelog: v2.2.2...v3.0.0
v2.2.1
What's Changed
- remove the
Money/UnsafeToMoney
cop by @elfassy in #291 - handle null currency money objects passed to constructor by @elfassy in #292
- re-allow coercing strings to money objects by @elfassy in #293
- Remove reference to deleted file by @mkorostoff-shopify in #295
- support coercible objects that respond to
to_money
by @elfassy in #294
Full Changelog: v2.2.0...v2.2.1
v2.2.0
What's Changed
- Better error if
Money#allocate
called with an empty array by @ghiculescu in #278 - Optimize
Money#split(n)
for largen
by @casperisfine in #287 - Revert "Drop support for initialization with another money object." by @elfassy in #289
- Bump version to v2.2.0 by @elfassy in #290
Full Changelog: v2.1.0...v2.2.0
v2.1.0
What's Changed
- improve the wording of the to_money deprecations warning by @elfassy in #283
- Allow newer SQLite3 by @casperisfine in #286
- Centralize Ruby Version to
.ruby-version
by @george-ma in #285 - Create new :nearest strategy for Money::Allocator by @raphpap in #284
- Bump version to 2.1.0 by @mkorostoff-shopify in #288
New Contributors
- @george-ma made their first contribution in #285
- @raphpap made their first contribution in #284
- @mkorostoff-shopify made their first contribution in #288
Full Changelog: v2.0.0...v2.1.0
v2.0.0
New Major Release 🎉
This is a major release because it introduces significant breaking changes to the API.
What's Changed
- Update code examples in the
README
by @ghiculescu in #275 - Drop support for Ruby 2.x and lower by @elfassy in #280
- Drop support for initialization with another money object by @csalvato in #279
- Drop support for multiplication of money objects by @csalvato in #279
Full Changelog: v1.3.0...v2.0.0
Breaking Change
- You cannot call
Money.new
to initialize aMoney
object with anotherMoney
object.- Example:
Money.new(Money.new(5, "USD"), "CAD)
will no longer work - More details on the rationale in #279
- Example:
- You cannot multiply
Money
objects by otherMoney
objects.- Example:
Money.new(5, "USD") * Money.new(10, "USD")
- This was dropped because support for this was deprecated 3 years ago, and continuing to support it adds unnecessary complexity for deprecated behavior.
- Example:
v1.3.0
What's Changed
- Fix UnsafeToMoney for receiver-less calls by @pjambet in #268
- 🚚 Rename the master branch to main by @fdelache in #270
- Allow splat arg in
Money/MissingCurrency
cop by @sambostock in #256 - update
to_money
to have the same behaviour asMoney.new
by @elfassy in #267
Full Changelog: v1.2.1...v1.3.0
New Contributors
Breaking Change
Those using to_money
to parse strings with thousands separators (ex: "1,234") and that do not use the legacy_deprecations
configuration are affected by this breaking change. You can choose to revert to the old behaviour by using Money::Parser::Fuzzy.parse
instead of using to_money
. Ideally you should parse thousand separators on the frontend using the user's locale instead of doing the parsing on the backend.