Array of hash: return or remove element with duplicate value

Hello,

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

Please help me. Thx

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