Sha256: b87d265810903064fe4880b95817c4bec742a7553a0cd76a57387e48e0e514a1

Contents?: true

Size: 513 Bytes

Versions: 6

Compression:

Stored size: 513 Bytes

Contents

module Furnace
  module Transform
    class IterativeProcess
      def initialize(stages)
        @stages = stages
      end

      def transform(*sequence)
        loop do
          changed = false

          @stages.each do |stage|
            return sequence if stage.nil?

            if new_sequence = stage.transform(*sequence)
              changed = true
              sequence = new_sequence
            end
          end

          return sequence unless changed
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
furnace-0.3.1 lib/furnace/transform/iterative_process.rb
furnace-0.3.0 lib/furnace/transform/iterative_process.rb
furnace-0.3.0.beta3 lib/furnace/transform/iterative_process.rb
furnace-0.3.0.beta2 lib/furnace/transform/iterative_process.rb
furnace-0.3.0.beta1 lib/furnace/transform/iterative_process.rb
furnace-0.2.6 lib/furnace/transform/iterative_process.rb