Advertisement
Guest User

Suggestion

a guest
Nov 13th, 2019
390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. def origin_destination_info(trips)
  2. origin_code = []
  3. destination_code = []
  4. departure_date = []
  5. arrival_date = []
  6. [trips].flatten.each do |this|
  7. origin_code << this[:departure_airport][:@location_code]
  8. destination_code << this[:arrival_airport][:@location_code]
  9. departure_date << this[:@departure_date_time]
  10. arrival_date << this[:@arrival_date_time]
  11. end
  12.  
  13. [origin_code.first, destination_code.first, departure_date.first, arrival_date.first]
  14. end
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22. ###########call this function like this
  23. origin_code, destination_code, departure_date, arrival_date = origin_destination_info(trips)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement