Class: DFuzz::Block
Overview
Serially generate each variable in turn (equivalent to recursively nesting generators)
Instance Method Summary collapse
-
#initialize(defaults, generators) ⇒ Block
constructor
A new instance of Block.
- #run(&block) ⇒ Object
Constructor Details
#initialize(defaults, generators) ⇒ Block
Returns a new instance of Block.
41 42 43 44 |
# File 'lib/ruckus/dfuzz.rb', line 41 def initialize(defaults, generators) @defaults = defaults @generators = generators end |
Instance Method Details
#run(&block) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/ruckus/dfuzz.rb', line 46 def run(&block) generators_index = 0 # Baseline block.call(@defaults) # Iterate through generators, fully exhausting each and # calling the code block with each set of values @generators.each { |g| values = Array.new(@defaults) while (g.next?) values[generators_index] = g.next block.call(values) end generators_index += 1; } end |