Sha256: 536c4ddec346753c1bae7a439a334ef9cb21aff35307a27b9835b688b29d0ce9
Contents?: true
Size: 417 Bytes
Versions: 7
Compression:
Stored size: 417 Bytes
Contents
# frozen_string_literal: true class Hash def array_slice_merge!(key, array, count) self[key] = array.each_slice(count).collect { |e| e.reduce({}, :merge) } end def deep_find(key, object = self, found = nil) return object[key] if object.respond_to?(:key?) && object.key?(key) return found unless object.is_a?(Enumerable) object.find { |*a| found = deep_find(key, a.last) } found end end
Version data entries
7 entries across 7 versions & 2 rubygems