Class: CowProxy::Struct
Overview
Wrapper class for Struct
Instance Method Summary collapse
-
#dig(key, *args) ⇒ Object
Extracts the nested value specified by the sequence of idx objects by calling dig at each step, returning nil if any intermediate step is nil.
Instance Method Details
#dig(key, *args) ⇒ Object
Extracts the nested value specified by the sequence of idx objects by calling dig at each step, returning nil if any intermediate step is nil.
8 9 10 11 |
# File 'lib/cow_proxy/struct.rb', line 8 def dig(key, *args) value = send(key) args.empty? ? value : value&.dig(*args) end |