This file contains 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
#You have seen something like this, if null replace with a blank array | |
an_array = (another_array || [] ) + (yet_another_array || []) | |
#But you could do this as well | |
an_array = another_array.to_a + yet_another_array.to_a | |
#Or you have seen this | |
an_array = another_array + (an_element_or_array.is_a?(Array) ? an_element_or_array : [an_element] ) | |
#But you could do this | |
an_array = another_array + an_element_or_array.to_a | |
Happy? I am happy! | |