Sha256: 9f38ed751a440eda5abdd7c93e1b4337d899d30921bfee4206043dc55f911f4b

Contents?: true

Size: 750 Bytes

Versions: 2

Compression:

Stored size: 750 Bytes

Contents

# frozen_string_literal: true

module Dynflow
  module Flows
    class Concurrence < AbstractComposed
      protected

      def add_to_sequence(satisfying_flows, dependent_flow)
        if satisfying_flows.empty?
          self.sub_flows << dependent_flow
          return
        end
        extracted_flow = extract_flows(satisfying_flows)
        sequence       = Sequence.new([extracted_flow])

        self.sub_flows << sequence
        sequence << dependent_flow
      end

      def extract_flows(extracted_sub_flows)
        extracted_sub_flows.each do |sub_flow|
          self.sub_flows.delete(sub_flow)
        end

        return Concurrence.new(extracted_sub_flows)
      end
    end

    Registry.register!(Concurrence, 'C')
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dynflow-1.9.0 lib/dynflow/flows/concurrence.rb
dynflow-1.8.3 lib/dynflow/flows/concurrence.rb