Sha256: 34bc53ba8a3370fafb8a3f11e3662addc1c133c7b5badc93b22ec0f0862d6907
Contents?: true
Size: 545 Bytes
Versions: 3
Compression:
Stored size: 545 Bytes
Contents
require 'tsort' module Dentaku class DependencyResolver include TSort def self.find_resolve_order(vars_to_dependencies_hash) self.new(vars_to_dependencies_hash).tsort end def initialize(vars_to_dependencies_hash) # ensure variables are strings @vars_to_deps = Hash[vars_to_dependencies_hash.map { |k, v| [k.to_s, v]}] end def tsort_each_node(&block) @vars_to_deps.each_key(&block) end def tsort_each_child(node, &block) @vars_to_deps[node.to_s].each(&block) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dentaku-1.2.4 | lib/dentaku/dependency_resolver.rb |
dentaku-1.2.3 | lib/dentaku/dependency_resolver.rb |
dentaku-1.2.2 | lib/dentaku/dependency_resolver.rb |