Class: ExcADG::DependencyManager
- Inherits:
-
Object
- Object
- ExcADG::DependencyManager
- Defined in:
- lib/excadg/dependency_manager.rb
Overview
manage list of dependencies dependencies could be of 2 types:
-
vertex - see vertex.rb
-
symbol - :name attribute of the vertex
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#deps ⇒ Object
readonly
Returns the value of attribute deps.
Instance Method Summary collapse
-
#deduct_deps(new_data) ⇒ Object
deduct (update) dependencies with new data - counts :done dependencies - preserves :done deps data.
-
#initialize(deps:) ⇒ DependencyManager
constructor
A new instance of DependencyManager.
Constructor Details
#initialize(deps:) ⇒ DependencyManager
Returns a new instance of DependencyManager.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/excadg/dependency_manager.rb', line 16 def initialize deps: Assertions.is_a? deps, Array Assertions.is_a? deps, [Vertex, Symbol] @deps = deps.collect { |raw_dep| case raw_dep when Symbol then VStateData::Key.new name: raw_dep when Vertex then VStateData::Key.new vertex: raw_dep end } @data = [] end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
13 14 15 |
# File 'lib/excadg/dependency_manager.rb', line 13 def data @data end |
#deps ⇒ Object (readonly)
Returns the value of attribute deps.
13 14 15 |
# File 'lib/excadg/dependency_manager.rb', line 13 def deps @deps end |
Instance Method Details
#deduct_deps(new_data) ⇒ Object
deduct (update) dependencies with new data
-
counts :done dependencies
-
preserves :done deps data
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/excadg/dependency_manager.rb', line 33 def deduct_deps new_data data = filter_foreign new_data Log.debug "received deps: #{data}" assert_failed data done_deps = data.select(&:done?) @data += done_deps Log.debug "done deps: #{done_deps}" @deps.reject! { |dep| done_deps.include? dep } Log.info "deps left: #{@deps.collect(&:to_s)}}" end |