Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Sunny Ripert <[email protected]>
  • Loading branch information
sirwolfgang and sunny committed May 16, 2024
1 parent a6389d0 commit c0ecce8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Upcoming 7.0.0.alpha

- **Potential breaking change**: Fix USDC decimals places from 2 to 6
- Allow `nil` to be used as a default_currency

## 6.19.0

Expand Down
4 changes: 2 additions & 2 deletions lib/money/money.rb
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def self.from_amount(amount, currency = default_currency, options = {})
raise ArgumentError, "'amount' must be numeric" unless Numeric === amount

currency = Currency.wrap(currency) || Money.default_currency
raise Currency::NoCurrency, 'must be provide a currency' if currency.nil?
raise Currency::NoCurrency, 'must provide a currency' if currency.nil?

value = amount.to_d * currency.subunit_to_unit
new(value, currency, options)
Expand Down Expand Up @@ -356,7 +356,7 @@ def initialize(obj, currency = Money.default_currency, options = {})

# BigDecimal can be Infinity and NaN, money of that amount does not make sense
raise ArgumentError, 'must be initialized with a finite value' unless @fractional.finite?
raise Currency::NoCurrency, 'must be provide a currency' if @currency.nil?
raise Currency::NoCurrency, 'must provide a currency' if @currency.nil?
end

# Assuming using a currency using dollars:
Expand Down

0 comments on commit c0ecce8

Please sign in to comment.