Compare an array of hashes against each other, both ways

From Stackoverflow by Edmundo  (that’s me)

The question:

I need to find the differences between saved_start and incoming_start, but also between incoming_start and saved_start. saved_start is the result of a db query while incoming_start is a result of params from a webhook. Here are the two arrays to start with:

 

I find the differences…………. for the complete question click this link

My Solution

Hello I hope the following code might help. this code will: (01)-Point values in Array 1 NOT found in array 2 … (02)-Point values in Array 2 Not found in Array 1 … (03)-Store all Unique Values in Array 2 …. For the description of the question I think this is what you are looking for, to make thing easier I rename the arrays to: arr1 & arr2.

 

I Hope this helps. 😉



Copyright 2017. All rights reserved.

Posted January 13, 2017 by Edmundo in category "Ruby Examples