-
Notifications
You must be signed in to change notification settings - Fork 2
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
Remove nth occurrence of aggregated item from an aggregation. #46
Comments
If nth occurrence is specified and is positive, then count from the beginning of the list. |
See usage with filtered associations... #45 |
It would more closely match the ruby enumerable API, and be more generally useful if we supported |
I am fine with
Examples... col1.members = [col1,obj1,obj2,col2,obj1,col1]
deleted_objs = col1.members.delete_at 3 # => [obj2]
col1.members # => [col1,obj1,col2,obj1,col1]
col1.members = [col1,obj1,obj2,col2,obj1,col1]
deleted_objs = col1.members.delete obj1 # => [obj1]
col1.members # => [col1,obj2,col2,obj1,col1] OR
# => [col1,obj2,col2,col1]
col1.members = [col1,obj1,obj2,col2,obj1,col1]
col1.child_objects # => [obj1,obj2,obj1]
deleted_objs = col1.child_objects.delete_at 3 # => [obj1]
col1.child_objects # => [obj1,obj2]
col1.members # => [col1,obj1,obj2,col2,col1]
col1.members = [col1,obj1,obj2,col2,obj1,col1]
col1.child_objects # => [obj1,obj2,obj1]
deleted_objs = col1.child_objects.delete obj1 # => [obj1]
col1.child_objects # => [obj2,obj1] OR [obj2] |
The standard ruby Array behavior is to delete all of them, and use delete_at if you want to delete just one. |
Items can repeat in aggregation. The syntax for the delete method needs to support removing the nth occurrence.
Example without repeat...
Example with repeat...
See also...
The text was updated successfully, but these errors were encountered: