lib/regexp-examples/helpers.rb in regexp-examples-1.3.2 vs lib/regexp-examples/helpers.rb in regexp-examples-1.4.0

- old
+ new

@@ -8,13 +8,16 @@ # permutations_of_strings [ ['a', 'b'], ['c', 'd'] ] #=> [ 'ac', 'ad', 'bc', 'bd' ] # # Edge case: # permutations_of_strings [ [] ] #=> nil # (For example, ths occurs during /[^\d\D]/.examples #=> []) - def self.permutations_of_strings(arrays_of_strings, max_results_limiter = MaxResultsLimiterByProduct.new) + def self.permutations_of_strings(arrays_of_strings, + max_results_limiter = MaxResultsLimiterByProduct.new) partial_result = max_results_limiter.limit_results(arrays_of_strings.shift) return partial_result if arrays_of_strings.empty? - partial_result.product(permutations_of_strings(arrays_of_strings, max_results_limiter)).map do |result| + partial_result.product( + permutations_of_strings(arrays_of_strings, max_results_limiter) + ).map do |result| join_preserving_capture_groups(result) end end def self.join_preserving_capture_groups(result)