Sha256: 9355475d94a56d9ab151412c8e0899063329c12f0d8269e5d2c089fe7e293a95

Contents?: true

Size: 325 Bytes

Versions: 10

Compression:

Stored size: 325 Bytes

Contents

require_relative '../../test_helper'
DuckPuncher.punch! :Object

class HashTest < MiniTest::Test
  def test_dig
    my_hash = { a: 1, b: { c: 2 } }.punch
    assert_equal my_hash.dig(:a), 1
    assert_equal my_hash.dig(:b, :a), nil
    assert_equal my_hash.dig(:b, :c), 2
    assert_equal my_hash.dig(:b), { c: 2 }
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
duck_puncher-2.15.0 test/lib/duck_puncher/hash_test.rb
duck_puncher-2.14.1 test/lib/duck_puncher/hash_test.rb
duck_puncher-2.14.0 test/lib/duck_puncher/hash_test.rb
duck_puncher-2.13.0 test/lib/duck_puncher/hash_test.rb
duck_puncher-2.12.1 test/lib/duck_puncher/hash_test.rb
duck_puncher-2.12.0 test/lib/duck_puncher/hash_test.rb
duck_puncher-2.11.0 test/lib/duck_puncher/hash_test.rb
duck_puncher-2.10.2 test/lib/duck_puncher/hash_test.rb
duck_puncher-2.10.1 test/lib/duck_puncher/hash_test.rb
duck_puncher-2.10.0 test/lib/duck_puncher/hash_test.rb