lib/maglev/facets/hash.rb
# similar to dig but allows for values to be retrieved by a path string such as "locations.0.name"
similar to dig but allows for values to be retrieved by a path string such as "locations.0.name"
similar to dig but allows for values to be retrieved by a path string such as " locations . 0 . name "
def value_path(path)
    path.split('.').reduce(self) do |a, b|
      if a
        if a.is_a?(Array)
          a[b.to_i]
        else
          a[b] || a[b.to_sym]
        end
      end
    end
  end
def value_path ( path ) path . split ( '.' ) . reduce ( self ) do | a , b | if a if a . is_a? ( Array ) a [ b . to_i ] else a [ b ] || a [ b . to_sym ] end end end end
similar to dig but allows for values to be retrieved by a path string such as "locations.0.name"
similar to dig but allows for values to be retrieved by a path string such as " locations . 0 . name "
path
<not_specific>