lib/regexp-examples/parser.rb in regexp-examples-0.3.2 vs lib/regexp-examples/parser.rb in regexp-examples-0.4.0
- old
+ new
@@ -1,11 +1,15 @@
module RegexpExamples
class Parser
attr_reader :regexp_string
- def initialize(regexp_string)
+ def initialize(regexp_string, options={})
@regexp_string = regexp_string
@num_groups = 0
@current_position = 0
+ RegexpExamples::ResultCountLimiters.configure!(
+ options[:max_repeater_variance],
+ options[:max_group_results]
+ )
end
def parse
repeaters = []
while @current_position < regexp_string.length