Sha256: db4ed6041e154334e32f696e45004daa8c4ddd10b6a918cc762a0fdbca0f6d85
Contents?: true
Size: 629 Bytes
Versions: 1
Compression:
Stored size: 629 Bytes
Contents
module Codependency class Graph def initialize( filenames ) @nodes = Hash[ filenames.map { |f| [ f, Node.new( f ) ] } ] end attr_reader :nodes def files nodes.reduce( [ ] ) do |list, (filename, node)| resolve node, list list end end protected def resolve( node, list ) unless list.include? node.filename node.dependencies.each do |dep| # TODO need to check here to make sure # we actually have a node for this dependency resolve nodes[ dep ], list end list << node.filename end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
codependency-0.1.0 | lib/codependency/graph.rb |