-
Notifications
You must be signed in to change notification settings - Fork 215
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
allow multiple organize calls in an organizer #134
allow multiple organize calls in an organizer #134
Conversation
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.
Very good, thank you!
lib/interactor/organizer.rb
Outdated
# end | ||
# | ||
# Returns nothing. | ||
def organize(*interactors) | ||
@organized = interactors.flatten | ||
@organized ||= [] |
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.
This already happens on line 66/68.
lib/interactor/organizer.rb
Outdated
# end | ||
# | ||
# Returns nothing. | ||
def organize(*interactors) | ||
@organized = interactors.flatten | ||
@organized ||= [] | ||
@organized += interactors.flatten |
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.
Rather than using +=
, we could concat
which won't duplicate the array in memory.
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.
def organize(*interactors)
organized.concat(interactors.flatten)
end
92656c0
to
d9de996
Compare
I've made the following change: - @organized ||= []
- @organized += interactors.flatten
+ organized.concat(interactors.flatten) Fixed up already existing commit. |
d9de996
to
aaa2bb6
Compare
@hedgesky I made a mess of this trying to resolve conflicts in the web interface. Could you please rebase this against |
675b049
to
5d28fbe
Compare
Done. |
Implements #127.