-
Notifications
You must be signed in to change notification settings - Fork 634
Add Money.with_bank for Dynamic Currency Stores #1145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better indeed, love the addition of the spec for thread-safety as well.
Can you add a CHANGELOG entry? 🙏🏻 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the addition, left some comments, mostly nitpicky 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry the delay! thanks for all the changes! this gem uses rbs
for typing the method. Would you mind adding that in a similar fashion to
Lines 221 to 234 in 377b0e8
# Temporarily changes the rounding mode in a given block. | |
# | |
# @param [BigDecimal::ROUND_MODE] mode | |
# | |
# @yield The block within which rounding mode will be changed. Its return | |
# value will also be the return value of the whole method. | |
# | |
# @return [Object] block results | |
# | |
# @example | |
# fee = Money.with_rounding_mode(BigDecimal::ROUND_HALF_DOWN) do | |
# Money.new(1200) * BigDecimal('0.029') | |
# end | |
def self.with_rounding_mode: (untyped mode) { () -> untyped } -> untyped |
🙏🏻
last thing and I meeeergeeeee
@yukideluxe Lets hope I've done it right :D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me! thanks! 🙏🏻
After some #discussions with @yukideluxe it seems like this library is a better place for this #PR.
This PR introduces the Money.with_bank method, allowing developers to assign different currency stores (banks) dynamically within a scoped block. This is particularly useful for loading custom exchange rates per user session.
Key Changes