Class: Furnace::Transform::IterativeProcess
- Inherits:
-
Object
- Object
- Furnace::Transform::IterativeProcess
- Defined in:
- lib/furnace/transform/iterative_process.rb
Instance Method Summary collapse
-
#initialize(stages) ⇒ IterativeProcess
constructor
A new instance of IterativeProcess.
- #transform(*sequence) ⇒ Object
Constructor Details
#initialize(stages) ⇒ IterativeProcess
Returns a new instance of IterativeProcess.
4 5 6 |
# File 'lib/furnace/transform/iterative_process.rb', line 4 def initialize(stages) @stages = stages end |
Instance Method Details
#transform(*sequence) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/furnace/transform/iterative_process.rb', line 8 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 |