
8 Dec
2023
8 Dec
'23
8:28 p.m.
Issue #20049 has been updated by chucke (Tiago Cardoso). I'd say it returns self, or nil if no changes were made, just like other ! Methods of the kind. ---------------------------------------- Feature #20049: Destructive drop_while for Array and Hash https://bugs.ruby-lang.org/issues/20049#change-105602 * Author: chucke (Tiago Cardoso) * Status: Open * Priority: Normal ---------------------------------------- I propose a "drop_while!" variant for arrays and hashes, which changes the current instance. ```ruby h = {foo: 0, bar: 1, baz: 2} h.drop_while!{|element| key, value = *element; value < 2 } h #=> # => { baz: 2 } ``` -- https://bugs.ruby-lang.org/