Sha256: 982a14a1dde0501b4591a81193c25287a92bc5bc7f9a2ea9e69007cee5373376

Contents?: true

Size: 247 Bytes

Versions: 23

Compression:

Stored size: 247 Bytes

Contents

class Hash
  def dig(key, *keys)
    value = self[key]
    if !value.nil? && !keys.empty?
      value.dig(*keys)
    else
      value
    end
  end

  def to_struct
    OpenStruct.new self
  end

  def amend(other)
    other.merge(self)
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
mumukit-core-0.1.3 lib/mumukit/core/hash.rb
mumukit-core-0.1.2 lib/mumukit/core/hash.rb
mumukit-core-0.1.1 lib/mumukit/core/hash.rb