Array of hash: return or remove element with duplicate value

Ciao ragazzi

Vorrei fare una cosa del genere:

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”}]

  1. 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

A me pare che i due input siano identici. Un copia e incolla di troppo o
l’ora tarda mi fa veder male?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs