lib/regexp-examples/repeaters.rb in regexp-examples-0.0.0 vs lib/regexp-examples/repeaters.rb in regexp-examples-0.0.1

- old
+ new

@@ -1,16 +1,17 @@ module RegexpExamples class BaseRepeater + attr_reader :group def initialize(group) @group = group end def result(min_repeats, max_repeats) - group_result = @group.result + group_results = @group.result[0 .. MaxGroupResults-1] results = [] min_repeats.upto(max_repeats) do |repeats| - group_result.each do |result| - results << result * repeats + group_results.each do |group_result| + results << group_result * repeats end end results.uniq end end