Module: ExtraLoop::Utils::DeepFetchable

Defined in:
lib/extraloop/utils.rb

Instance Method Summary collapse

Instance Method Details

#get_in(path) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/extraloop/utils.rb', line 44

def get_in(path)
  keys, node = Array(path), self

  keys.each_with_index do |key, index|
    node = node[key]
    next_key = keys[index + 1]
    break unless node
  end

  node
end