-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add deep_clone and deep_delete #91
Conversation
LGTM to me...can you also update the README? |
@Fryguy Done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM... @bdunne if you are good with this feel free to merge.
# h1[:a] # "hello world" | ||
# h2[:a] # "hello" | ||
# | ||
def deep_clone |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of #deep_clone
living in https://github.com/ManageIQ/more_core_extensions/blob/master/lib/more_core_extensions/core_ext/shared/nested.rb instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would putting it there mean that users would have to explicitly include it to use it? I guess I'm not entirely clear on that particular module's approach as compared to the others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bdunne ok, updated.
Checked commits https://github.com/djberg96/more_core_extensions/compare/7781fe4acf664e31993e2cb65fdc748b146011ee~...d4f8eaef0e8cbab360d350dad05686c5a735d37c with ruby 2.5.7, rubocop 0.69.0, haml-lint 0.28.0, and yamllint spec/core_ext/hash/deletes_spec.rb
|
This PR adds the
deep_clone
anddeep_delete
methods to theArray
andHash
classes.The implementations were pulled from miq-deep.rb in gems-pending.
Since the
deep_clone
implementation was identical for both classes, I put them in a single file (enumerable.rb) and extended both classes from there. The idea is not only to avoid duplication, but other Enumerable classes could be easily added in the future as desired.Part of the cleanup effort at ManageIQ/manageiq-gems-pending#231