Ask A Question
Notifications
You’re not receiving notifications from this thread.
Hashes in Ruby Discussion
Discussion for Hashes in Ruby
If we use h = HashWithIndifferentAccess.new({key: "value"})
it will allow us to access the value through both h[:key]
and h["key"]
.
Hey Yago, while this is true, HashWithIndifferentAccess is only available via ActiveSupport. This section of the learning path is focused purely on Ruby.
Absolutely, HashWithIndifferentAccess is handy for treating keys as either symbols or strings. It provides flexibility when accessing values, making your code more user-friendly and versatile.