The Rails I18n library transforms a YAML file into a data structure that is accessible via a dotted path call using the t() function.
t(\'one.two.three.four\
Ruby 2.3 introduces the dig method that looks into nested arrays/hashes, it returns nil
when no data is found.
For example:
test_data = {a: {b: {c: {d: 1}, e: 2}}}
path = 'a.b.c.d'.split('.').map(&:to_sym)
# path => [:a, :b, :c, :d]
test_data.dig(*path)
Of course if your nested use string keys, the to_sym step is not needed.