class Inprovise::Resolver
Script dependency Resolver
for Inprovise
- Author
-
Martin Corino
- License
-
Distributes under the same license as Ruby
Attributes
scripts[R]
Public Class Methods
new(script,index=nil)
click to toggle source
# File lib/inprovise/resolver.rb, line 8 def initialize(script,index=nil) @script = script @index = index || Inprovise::ScriptIndex.default @last_seen = script @scripts = [@script] end
Public Instance Methods
resolve()
click to toggle source
# File lib/inprovise/resolver.rb, line 15 def resolve begin @script.dependencies.reverse.each do |d| @scripts.insert(0, *Inprovise::Resolver.new(@index.get(d), @index).resolve.scripts) end @script.children.each do |c| child = @index.get(c) @scripts.concat(Inprovise::Resolver.new(child, @index).resolve.scripts) unless @scripts.include?(child) end rescue SystemStackError raise CircularDependencyError.new end @scripts.uniq! self end