class Vissen::Parameterized::Graph

The graph implements a mechanism for updating and untainting a set of interconnected paramaeterized objects.

Public Class Methods

new(end_nodes, scope: GlobalScope.instance) click to toggle source

@raise [ScopeError] if any of the end nodes are not included in the

scope.

@param end_nodes [Array<Parameterized>] the top level parameterized

objects.

@param scope [Scope] the scope in which the graph (and the end nodes)

exists.
# File lib/vissen/parameterized/graph.rb, line 15
def initialize(end_nodes, scope: GlobalScope.instance)
  end_nodes.each do |node|
    raise ScopeError unless scope.include? node
  end

  @end_nodes = end_nodes

  freeze
end

Public Instance Methods

update!() { |value| ... } click to toggle source

Updates the entire graph.

# File lib/vissen/parameterized/graph.rb, line 26
def update!
  @end_nodes.each(&:tainted?)
  @end_nodes.each(&:untaint!)

  @end_nodes.each { |node| yield node.value } if block_given?
end