Skip to content

Instantly share code, notes, and snippets.

@pumpkincouture
Created September 20, 2014 23:58
Show Gist options
  • Save pumpkincouture/bc0cdd90194aa94a3b4b to your computer and use it in GitHub Desktop.
Save pumpkincouture/bc0cdd90194aa94a3b4b to your computer and use it in GitHub Desktop.
def gather_legs(first_leg, second_leg, third_leg)
flights = []
second_leg_number = -1
third_leg_number = -1
first_leg.each {|leg| flights << [leg, second_leg[second_leg_number += 1], third_leg[third_leg_number += 1]].flatten}
flights
end
def delete_nil(flights_array)
flights_array.each do |array|
if array.include? nil
array.delete(nil)
else
flights_array
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment