a = [{a: 1, b: 3, c: 1}]
l = [1]
a.dup.select{|skill| l.include?(skill.delete(:a)) }
a
# => [{:b=>3, :c=>1}]
a = [{a: 1, b: 3, c: 1}]
l = [1]
b = a.dup
b.dup.select{|skill| l.include?(skill.delete(:a)) }
a
# => [{:b=>3, :c=>1}]
a = [{a: 1, b: 3, c: 1}]
l = [1]
a.dup.select{|skill| l.include?(skill.deep_dup.delete(:a)) }
# => [{:a=>1, :b=>3, :c=>1}]
# 只能这样 ??
a.select{|skill| l.include?(skill["a"]) }.delete_if{|k, v| k.to_s.eql?("a")}