Class: CowProxy::Struct

Inherits:
WrapClass
  • Object
show all
Defined in:
lib/cow_proxy/struct.rb

Overview

Wrapper class for Struct

Instance Method Summary collapse

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.

Returns:

  • CowProxy wrapped value from wrapped object



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