-
Notifications
You must be signed in to change notification settings - Fork 533
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
to_h should behave the same as to_hash #1008
Comments
Hi @mehagar , thanks for your report and sorry you're experiencing this issue! You're right that Unfortunately making this change is not backwards compatible, and so will have to take place in the next major version. For now I'll tag this issue with 'future' to indicate this and we'll track this work internally. Thanks again! Footnotes
|
Just adding an extra note here that As an example:
There's a good discussion to be had here around what our implementation should be for That being said, changing either of these methods is still not backwards compatible so will wait for the next major version. |
Ruby version: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19]
Stripe gem version: 5.38.0
I was trying to convert a
Stripe::StripeObject
to a hash that maps symbols to strings. I called#to_h
on that object, and instead of a hash from symbols to strings, I got a hash from symbols to strings and objects, where a stripe object was expanded in the response. Meanwhile, the#to_hash
method did what I was expecting, and instead of storing a Ruby object as the value, converted that object to a hash of symbols to strings.I would expect
to_h
to behave the same asto_hash
to avoid suprising behavior.The text was updated successfully, but these errors were encountered: