I have the following array:
array = [{"email"=>"[email protected]", "name"=>"Test"},
{"email"=>"[email protected]", "name"=>"Test A"},
{"name"=>"Test B", "email"=>"[email protected]"},
{"email"=>"[email protected]", "name"=>"Test C"},
{"name"=>"Test D", "email"=>"[email protected]"},
{"email"=>"[email protected]"},
{"name"=>"Test F", "email"=>"[email protected]"}]
I have a list of "blacklist" emails, for instance:
blacklist = ["[email protected]"]
I want to do something like this:
array - blacklist
# => should remove element {"email"=>"[email protected]", "name"=>"Test C"}
Surely there is a sexy-Ruby way to do this with .select or something, but I haven't been able to figure it out. I tried this to no avail:
array.select {|k,v| v != "[email protected]"} # => returns array without any changes