Sha256: 5f79f09306ae7f0090d982f47dde386f83b2de255e4178defd61d13a66e98844
Contents?: true
Size: 1.53 KB
Versions: 6
Compression:
Stored size: 1.53 KB
Contents
module Trailblazer module Activity::Magnetic class Builder module Finalizer def self.call(adds) tripletts = adds_to_tripletts(adds) circuit_hash = tripletts_to_circuit_hash( tripletts ) circuit_hash_to_process( circuit_hash ) end def self.adds_to_tripletts(adds) alterations = adds_to_alterations(adds) alterations.to_a end def self.adds_to_alterations(adds) alterations = DSL::Alterations.new adds = adds.compact # TODO: test me explicitly, and where does this come from anyway? adds.each { |method, cfg| alterations.send( method, *cfg ) } alterations end def self.tripletts_to_circuit_hash(tripletts) Activity::Magnetic::Generate.( tripletts ) end def self.circuit_hash_to_process(circuit_hash) end_events = end_events_for(circuit_hash) return Circuit.new(circuit_hash, end_events), end_events end # Filters out unconnected ends, e.g. the standard end in nested tracks that weren't used. def self.end_events_for(circuit_hash) tasks_with_incoming_edge = circuit_hash.values.collect { |connections| connections.values }.flatten(1) ary = circuit_hash.collect do |task, connections| task.kind_of?(Activity::End) && connections.empty? && tasks_with_incoming_edge.include?(task) ? task : nil end ary.compact end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems