lib/array.rb in markdown_exec-1.8.7 vs lib/array.rb in markdown_exec-1.8.8
- old
+ new
@@ -2,9 +2,13 @@
# frozen_string_literal: true
# encoding=utf-8
class Array
+ def pluck(key)
+ map { |hash| hash[key] if hash.is_a?(Hash) }.compact
+ end
+
# Processes each element of the array, yielding the previous, current, and next elements to the given block.
# Deletes the current element if the block returns true.
# @return [Array] The modified array after conditional deletions.
def process_and_conditionally_delete!
i = 0