lib/simple_ext/hash/slice.rb in simple_ext-0.1.0 vs lib/simple_ext/hash/slice.rb in simple_ext-0.1.1
- old
+ new
@@ -21,6 +21,8 @@
# { a: 1, b: 2, c: 3, d: 4 }.extract!(:a, :b) # => {:a=>1, :b=>2}
# { a: 1, b: 2 }.extract!(:a, :x) # => {:a=>1}
def extract!(*keys)
keys.each_with_object(self.class.new) { |key, result| result[key] = delete(key) if has_key?(key) }
end
+
+ alias_method :extract, :slice
end