Module: CoreExtensions::Regexp::Examples
- Defined in:
- lib/core_extensions/regexp/examples.rb
Overview
A wrapper module to namespace/isolate the Regexp#examples and Regexp#random_example monkey patches. No core classes are extended in any way, other than the above two methods.
Instance Method Summary collapse
Instance Method Details
#examples(**config_options) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/core_extensions/regexp/examples.rb', line 7 def examples(**) RegexpExamples::ResultCountLimiters.configure!( max_repeater_variance: [:max_repeater_variance], max_group_results: [:max_group_results], max_results_limit: [:max_results_limit] ) examples_by_method(:result) end |
#random_example(**config_options) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/core_extensions/regexp/examples.rb', line 16 def random_example(**) RegexpExamples::ResultCountLimiters.configure!( max_repeater_variance: [:max_repeater_variance] ) examples_by_method(:random_result).sample(1).first end |