最佳答案
我有个大麻:
h1 = {:a => :A, :b => :B, :c => :C, :d => :D}
提取这样的子散列的最佳方法是什么?
h1.extract_subhash(:b, :d, :e, :f) # => {:b => :B, :d => :D}
h1 #=> {:a => :A, :c => :C}