class ActionDispatch::Journey::Formatter

def build_cache

def build_cache
  root = { ___routes: [] }
  routes.routes.each_with_index do |route, i|
    leaf = route.required_defaults.inject(root) do |h, tuple|
      h[tuple] ||= {}
    end
    (leaf[:___routes] ||= []) << [i, route]
  end
  root
end