module Dig
Overview
Object#dig and Object#dig? methods are used to returns deeply nested values. Ideas taken from: https://www.reddit.com/r/crystal_programming/comments/477bnn/crystal_on_steroids/d0c07lt
Direct including types
Defined in:
crystal_on_steroids/dig.crInstance Method Summary
- #dig(index)
-
#dig(index, *keys)
Retrieves the value object corresponding to the each key objects repeatedly.
Instance Method Detail
def dig(index, *keys)
#
Retrieves the value object corresponding to the each key objects repeatedly.
h = { foo: {bar: {baz: 5}}}
h.dig(:foo, :bar, :baz) #=> 5
h.dig(:foo, :blah) #=> nil