Sha256: 0c66082ceb16c516798cbd82f1fc17235cfc44980a7ec2a8b50c91ce8ef76eaf

Contents?: true

Size: 362 Bytes

Versions: 2

Compression:

Stored size: 362 Bytes

Contents

# override Hash class
class Hash
  def each_with_parent(parent = nil, &block)
    each do |key, value|
      if value.is_a?(Hash)
        deep_hash_with_parent(value, key, &block)
      elsif block_given?
        yield(parent, key, value)
      end
    end
  end

  def deep_hash_with_parent(value, key, &block)
    value.each_with_parent(key, &block)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
asana_exception_notifier-0.3.8 lib/asana_exception_notifier/initializers/hash.rb
asana_exception_notifier-0.3.7 lib/asana_exception_notifier/initializers/hash.rb