Skip to content

Instantly share code, notes, and snippets.

@awilkening
Created June 29, 2017 03:05
Show Gist options
  • Save awilkening/ccadfbfcdd0fa492d0753288479bcfdc to your computer and use it in GitHub Desktop.
Save awilkening/ccadfbfcdd0fa492d0753288479bcfdc to your computer and use it in GitHub Desktop.
def smush(array, container = [])
array.each do |element|
if element.is_a? Array
smush element, container
else
container << element
end
end
container
end
if smush([[1,2,[3]],4]) == [1,2,3,4]
puts "Smushed"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment