Project

General

Profile

Actions

Feature #20049

closed

Destructive drop_while for Array and Hash

Added by chucke (Tiago Cardoso) 5 months ago. Updated 5 months ago.

Status:
Feedback
Assignee:
-
Target version:
-
[ruby-core:115648]

Description

I propose a "drop_while!" variant for arrays and hashes, which changes the current instance.

h = {foo: 0, bar: 1, baz: 2}
h.drop_while!{|element| key, value = *element; value < 2 }
h #=> # => { baz: 2 }
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0