Sha256: bd8301ecf6cdc82d0adc5cd8aedf36c87755b35ea0a0f49b14690a28ded262d4
Contents?: true
Size: 762 Bytes
Versions: 5
Compression:
Stored size: 762 Bytes
Contents
module SearchCraft::DependsOn module ClassMethods @@dependencies = {} def depends_on(*builder_names) @@dependencies[name] = builder_names end def sort_builders_by_dependency sorted = [] visited = {} builders_to_rebuild.each do |builder| visit(builder, visited, sorted) end sorted end def visit(builder, visited, sorted) return if visited[builder.name.to_s] dependency_names = @@dependencies[builder.name] || [] dependency_names.each do |dependency_name| dependency = Object.const_get(dependency_name) visit(dependency, visited, sorted) end visited[builder.name.to_s] = true sorted << builder end end extend ClassMethods end
Version data entries
5 entries across 5 versions & 1 rubygems