I am trying to remove the entire row for id and name for 001 and 002from the sample:
sample = [{"id"=>"000", "name"=>"Bob"},
{"id"=>"001", "name"=>"Sally"},
{"id"=>"002", "name"=>"Spike"},
{"id"=>"003", "name"=>"Junior"},
{"id"=>"004", "name"=>"Tater"}]
remove_ele = ["001","002"]
I have tried the following, but it doesn't seem to work:
sample.delete_if { |key, value| sample[x]["id"] == remove_ele[x] }
essentially, i'm trying to compare the 2 and any matches in remove_ele it will just delete the entire row/element in sample.
Please assist in best way to do this in ruby.