lib/lopata/scenario_builder.rb in lopata-0.1.11 vs lib/lopata/scenario_builder.rb in lopata-0.1.12

- old
+ new

@@ -446,20 +446,21 @@ end end # @private class Option - attr_reader :variants, :key - def initialize(key, variants) + attr_reader :variants, :key, :use_all_variants + def initialize(key, variants, use_all_variants = true) @key = key @variants = if variants.is_a? Hash variants.map { |title, value| Variant.new(self, key, title, value) } else # Array of arrays of two elements variants.map { |v| Variant.new(self, key, *v) } end + @use_all_variants = use_all_variants end # Variants to apply at one level def level_variants variants @@ -467,9 +468,10 @@ def next_variant @current ||= 0 selected_variant = variants[@current] @current += 1 + @complete = true unless use_all_variants # not need to verify all variants, just use first ones. if @current >= variants.length @current = 0 @complete = true # all variants have been selected end selected_variant