def to_sorted_array
            dependency_hash = parse_to_hash(raw_dependencies)
            sorted_arr = tsort(dependency_hash)

            idx = sorted_arr.find_index do |dep|
              if view_to_refresh.to_s.include?(".")
                dep == view_to_refresh.to_s
              else
                dep.ends_with?(".#{view_to_refresh}")
              end
            end

            if idx.present?
              sorted_arr[0...idx]
            else
              []
            end
          end
We're given an array from the SQL query that looks kind of like this
[["view_name", "{'dependency_1', 'dependency_2'}"]]

We need to parse that into a more easy to understand data type so we
can use the Tsort module from the Standard Library to topologically
sort those out so we can refresh in the correct order, so we parse
that raw data into a hash.

Then, once Tsort has worked it magic, we're given a sorted 1-D array
["dependency_1", "dependency_2", "view_name"]

So we then need to slice off just the bit leading up to the view
that we're refreshing, so we find where in the topologically sorted
array our given view is, and return all the dependencies up to that
point.