aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/topological_hash.rb
blob: 2e484a28d3f1c8e273d5ca743c14449735065da0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
require "tsort"

# a basic topologically sortable hashmap
module Hbc
  class TopologicalHash < Hash
    include TSort

    alias tsort_each_node each_key

    def tsort_each_child(node, &block)
      fetch(node).each(&block)
    end
  end
end