Sha256: 5732fd505103a919ad8ddf19408e335a69555c9bcd74edfe4089e604afc83b5e

Contents?: true

Size: 388 Bytes

Versions: 4

Compression:

Stored size: 388 Bytes

Contents

RSpec.describe "Hash#auto_dig" do

  it "should recursively find the value for the given hash key" do
    hash   = {a: 1, b: {c: 2, d: {e: 3}}}
    result = hash.auto_dig :e
    expect(result).to eq 3
  end


  it "should return nil if the given hash key is not present" do
    hash   = {a: 1, b: {c: 2, d: {e: 3}}}
    result = hash.auto_dig :f
    expect(result).to be_nil
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
eitil-1.2.4 spec/eitil_core/hash/auto_dig_spec.rb
eitil-1.2.3 spec/eitil_core/hash/auto_dig_spec.rb
eitil-1.2.2 spec/eitil_core/hash/auto_dig_spec.rb
eitil-1.2.1 spec/eitil_core/hash/auto_dig_spec.rb