Sha256: 2ca149d86e37e9a5d6792bb506f6c8c91e75f38ef9c11fe110487745c08d65c8

Contents?: true

Size: 373 Bytes

Versions: 30

Compression:

Stored size: 373 Bytes

Contents

require 'tsort'

module Pupa
  class Processor
    # A simple implementation of a dependency graph.
    #
    # @see http://ruby-doc.org/stdlib-2.0.0/libdoc/tsort/rdoc/TSort.html
    class DependencyGraph < Hash
      include TSort

      alias tsort_each_node each_key

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

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
pupa-0.0.10 lib/pupa/processor/dependency_graph.rb
pupa-0.0.9 lib/pupa/processor/dependency_graph.rb
pupa-0.0.8 lib/pupa/processor/dependency_graph.rb
pupa-0.0.7 lib/pupa/processor/dependency_graph.rb
pupa-0.0.6 lib/pupa/processor/dependency_graph.rb
pupa-0.0.5 lib/pupa/processor/dependency_graph.rb
pupa-0.0.4 lib/pupa/processor/dependency_graph.rb
pupa-0.0.3 lib/pupa/processor/dependency_graph.rb
pupa-0.0.2 lib/pupa/processor/dependency_graph.rb
pupa-0.0.1 lib/pupa/processor/dependency_graph.rb