Closed fervic closed 9 years ago
The implementation looks clean and straightforward. Once you make the changes to the tests, I'd be happy to merge it in.
@aetherknight I'm glad you suggested to add the test about not modifying the original hash because it is not passing. At the first level it is a different reference, but after that they continue pointing to the same structure. I don't know if the only option would be to store the references on a separate variable that is recursively passed to the initialize method.
I think I found a solution by deep duplicating the first input hash (when the flag is set to false).
I just tried using active_support's deep_dup just to be able verify it quickly. I will now work in bringing this logic into the class and then push so you can review.
@aetherknight it should be good to go now. Please review and let me know. At the end it wasn't as simple as I initially thought.
I'm going to merge this in, and then I'll address the recurse_over_arrays
x deep_dup
case before cutting a new release. Thanks for your hard work!
Fixes #9 by keeping a reference of the hash upon initialization instead of creating an empty hash. Only does this if specified in the options hash.