Hash Slicing
Hash slicing now core
The Hash#[] and Hash#[]= methods have been refactored to support hash slicing out of the box.
hash = {'a', 1, 'b', 2}
hash['a', 'b'] => [1, 2]
hash['a', 'b'] = 7, 8
hash['a'] => 7
hash['b'] => 8
Hash slicing now core
Added by Daniel Berger 788 days ago
The Hash#[] and Hash#[]= methods have been refactored to support hash slicing out of the box.
hash = {'a', 1, 'b', 2}
hash['a', 'b'] => [1, 2]
hash['a', 'b'] = 7, 8
hash['a'] => 7
hash['b'] => 8
Comments