Skip to content

Commit

Permalink
OXR bank uses nilable Floats :vomit:
Browse files Browse the repository at this point in the history
  • Loading branch information
swiknaba committed Jul 18, 2023
1 parent 7ba7d3d commit 3e16a91
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/money/distributed/storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ def initialize(redis, cache_ttl = nil)
params(
iso_from: String,
iso_to: String,
rate: BigDecimal,
rate: T.nilable(Numeric),
).void
end
def add_rate(iso_from, iso_to, rate)
# other gems, e.g. "money-open-exchange-rates", may return nil and use Float
return if rate.nil?

@redis.exec do |r|
r.hset(REDIS_KEY, key_for(iso_from, iso_to), rate.to_s)
end
Expand Down

0 comments on commit 3e16a91

Please sign in to comment.