Skip to content

Commit c7dc80a

Browse files
author
Tom Lord
committed
document method for setting global result limit config
1 parent 17944a2 commit c7dc80a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Extends the `Regexp` class with the methods: `Regexp#examples` and `Regexp#rando
1212

1313
\* If the regex has an infinite number of possible strings that match it, such as `/a*b+c{2,}/`,
1414
or a huge number of possible matches, such as `/.\w/`, then only a subset of these will be listed.
15-
1615
For more detail on this, see [configuration options](#configuration-options).
1716

1817
If you'd like to understand how/why this gem works, please check out my [blog post](https://tom-lord.github.io/Reverse-Engineering-Regular-Expressions/) about it.
@@ -149,7 +148,15 @@ When generating examples, the gem uses 3 configurable values to limit how many e
149148

150149
`Rexexp#examples` makes use of *all* these options; `Rexexp#random_example` only uses `max_repeater_variance`, since the other options are redundant.
151150

152-
To use an alternative value, simply pass the configuration option as follows:
151+
To use an alternative value, you can either define a different default value:
152+
153+
```ruby
154+
RegexpExamples::ResultCountLimiters.max_repeater_variance = 5
155+
RegexpExamples::ResultCountLimiters.max_group_results = 10
156+
RegexpExamples::ResultCountLimiters.max_results_limit = 20000
157+
```
158+
159+
Or, simply pass the configuration option as a parameter:
153160

154161
```ruby
155162
/a*/.examples(max_repeater_variance: 5)

0 commit comments

Comments
 (0)