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.
Simon E. (Guest)
on 2015-11-26 11: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
Paolo M. (Guest)
on 2015-11-27 23: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.