Skip to content

to_h should behave the same as to_hash #1008

@mehagar

Description

@mehagar

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 as to_hash to avoid suprising behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions