Class: RegexpExamples::ResultCountLimiters
- Inherits:
-
Object
- Object
- RegexpExamples::ResultCountLimiters
- Defined in:
- lib/regexp-examples/constants.rb
Overview
Configuration settings to limit the number/length of Regexp examples generated
Constant Summary collapse
- MAX_REPEATER_VARIANCE_DEFAULT =
The maximum variance for any given repeater, to prevent a huge/infinite number of examples from being listed. For example, if @@max_repeater_variance = 2 then: .* is equivalent to .0,2 .+ is equivalent to .1,3 .2, is equivalent to .2,4 .,3 is equivalent to .0,2 .3,8 is equivalent to .3,5
2- MAX_GROUP_RESULTS_DEFAULT =
Maximum number of characters returned from a char set, to reduce output spam For example, if @@max_group_results = 5 then: d is equivalent to [01234] w is equivalent to [abcde]
5
Class Attribute Summary collapse
-
.max_group_results ⇒ Object
readonly
Returns the value of attribute max_group_results.
-
.max_repeater_variance ⇒ Object
readonly
Returns the value of attribute max_repeater_variance.
Class Method Summary collapse
Class Attribute Details
.max_group_results ⇒ Object (readonly)
Returns the value of attribute max_group_results.
21 22 23 |
# File 'lib/regexp-examples/constants.rb', line 21 def max_group_results @max_group_results end |
.max_repeater_variance ⇒ Object (readonly)
Returns the value of attribute max_repeater_variance.
21 22 23 |
# File 'lib/regexp-examples/constants.rb', line 21 def max_repeater_variance @max_repeater_variance end |
Class Method Details
.configure!(max_repeater_variance, max_group_results = nil) ⇒ Object
22 23 24 25 |
# File 'lib/regexp-examples/constants.rb', line 22 def configure!(max_repeater_variance, max_group_results = nil) @max_repeater_variance = (max_repeater_variance || MAX_REPEATER_VARIANCE_DEFAULT) @max_group_results = (max_group_results || MAX_GROUP_RESULTS_DEFAULT) end |