Sha256: 8b09c8e2777d03c3fbf5dbf1d27a8e1ef7fa15aaeb0bc91ab9fa2889b3060db2

Contents?: true

Size: 386 Bytes

Versions: 1

Compression:

Stored size: 386 Bytes

Contents

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

1 entries across 1 versions & 1 rubygems

Version Path
awis-sdk-ruby-1.0.0 lib/awis/hash.rb