Forum: Italian Ruby user group ARRAY OF HASH: RETURN OR REMOVE ELEMENT WITH DUPLICATE VALUE

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
027f88d17068dde230d0261d70bea262?d=identicon&s=25 Simon Eric (noumedem)
on 2015-11-26 10:18
Ciao ragazzi

Vorrei fare una cosa del genere:

1)
Input:

a = [{:scan_name=>"cse", :ip=>" 12"}, {:scan_name=>"e", :ip=>"18"},
{:scan_name=>"df", :ip=>"18"}]

Output:

b = [ {:scan_name=>"e", :ip=>"18"}, {:scan_name=>"df", :ip=>"18"}]


2) Input

a = [{:scan_name=>"cse", :ip=>" 12"}, {:scan_name=>"e", :ip=>"18"},
{:scan_name=>"df", :ip=>"18"}]


Output:

b = [ {:scan_name=>"cse", :ip=>" 12"}]

Come fare?

Grazie mille
7de465f222e6a9c7fe658e370d0bfe05?d=identicon&s=25 Paolo Montrasio (pmontrasio)
on 2015-11-27 22:24
A me pare che i due input siano identici. Un copia e incolla di troppo o
l'ora tarda mi fa veder male?
This topic is locked and can not be replied to.