aetherknight / recursive-open-struct

OpenStruct subclass that returns nested hash attributes as RecursiveOpenStructs
Other
276 stars 54 forks source link

Add merge functionality #44

Closed davich closed 7 years ago

davich commented 8 years ago

Allows the merging of a hash or another RecursiveOpenStruct

davich commented 8 years ago

There is a failing test on ruby-head, but I don't think it's from my change... It seems to be failing on master, too.

aetherknight commented 7 years ago

This causes another attribute name to become reserved and unusable (eg, if the original hash has a "merge" attribute, you won't be able to access it normally on the ROS. It also makes the ROS more Hash-like than OpenStruct-like.

Is there some reason why ros.merge(some_h) is preferable to something likeros.class.new(ros.to_h.merge(some_h))?

davich commented 7 years ago

The merge method makes the code look nicer. But you're right, it does create another reserved word which isn't great. It's your call. Feel free to close this PR if you'd like.