Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #7387
| From | Robert Klemme <shortcutter@googlemail.com> |
|---|---|
| Newsgroups | comp.lang.ruby |
| Subject | Re: Compare hashes and report where the change was |
| Date | 2018-04-09 18:15 +0200 |
| Message-ID | <fj1htoFbvoiU1@mid.individual.net> (permalink) |
| References | <61b0c250-c95a-4614-9cba-95b804aec2a7@googlegroups.com> |
On 09.04.2018 17:01, Abdel Latif wrote:
> I would like to compare two hashes, for example:
>
> array1 = [{'id' => 124, 'name' => 'Kamal', 'job' => 'manager'},
> {'id' => 314, 'name' => 'John', 'job' => 'developer'}]
> array2 = [{'id' => 124, 'name' => 'Kamal', 'job' => 'managerZ'},
> {'id' => 314, 'name' => 'JohnDD', 'job' => 'developer'}]
>
> The id is not always "id", it could be UserID or EmployeeID or else, need to create a :
>
> def compare_rows(array1,array2,id)
>
> I want to report:
>
> row with id equal 124, job changed from 'manager' to 'managerZ'
> row with id equal 314, name changed from 'John' to 'JohnDD'
What was your question again?
Cheers
robert
--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
Back to comp.lang.ruby | Previous | Next — Previous in thread | Find similar
Compare hashes and report where the change was Abdel Latif <mlotfi2005@gmail.com> - 2018-04-09 08:01 -0700 Re: Compare hashes and report where the change was Robert Klemme <shortcutter@googlemail.com> - 2018-04-09 18:15 +0200
csiph-web