Open
Conversation
|
|
||
| array.each do |element| | ||
| flattened_array = self.add_element_array(element, flattened_array) | ||
| end |
There was a problem hiding this comment.
You might want to add a new line here.
Suggested change
| end | |
| end | |
| end | ||
|
|
||
| def self.add_element_array(element, array) | ||
| # binding.pry |
| else | ||
| array << element | ||
| end | ||
| array |
There was a problem hiding this comment.
An explicit return might make this more legible.
Suggested change
| array | |
| return array |
| end | ||
| end | ||
|
|
||
| module BookKeeping |
There was a problem hiding this comment.
It might just be me, but it's a little hard to understand what this is doing. Could you maybe add a comment for context?
AngelaOh
reviewed
Aug 15, 2019
| end | ||
|
|
||
| def self.add_element_array(element, array) | ||
| # binding.pry |
There was a problem hiding this comment.
Suggested change
| # binding.pry |
Consider removing this line if we are wanting to push to prod.
| def self.flatten(array) | ||
| flattened_array = [] | ||
|
|
||
| array.each do |element| |
There was a problem hiding this comment.
Consider using a .map instead of .each. This would not require declaring var in line 5.
Faiza1987
reviewed
Aug 15, 2019
|
|
||
| module BookKeeping | ||
| VERSION = 1 # Where the version number matches the one in the test. | ||
| end |
piffer59
reviewed
Aug 15, 2019
| else | ||
| array << element | ||
| end | ||
| array |
| array.each do |element| | ||
| flattened_array = self.add_element_array(element, flattened_array) | ||
| end | ||
| flattened_array.compact |
There was a problem hiding this comment.
compact returns a copy of the array which increases space complexity.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.