Sha256: 05338bfd9b43ce2fad4cbdcbe6e9ba2604d984808c1d936e3a8118320d5b69b3
Contents?: true
Size: 949 Bytes
Versions: 2
Compression:
Stored size: 949 Bytes
Contents
module CoreExtensions module Regexp module Examples def examples(**config_options) RegexpExamples::ResultCountLimiters.configure!( config_options[:max_repeater_variance], config_options[:max_group_results] ) examples_by_method(:map_results) end def random_example(**config_options) RegexpExamples::ResultCountLimiters.configure!( config_options[:max_repeater_variance] ) examples_by_method(:map_random_result).first end private def examples_by_method(method) full_examples = RegexpExamples.public_send( method, RegexpExamples::Parser.new(source, options).parse ) RegexpExamples::BackReferenceReplacer.new.substitute_backreferences(full_examples) end end end end # Regexp#include is private for ruby 2.0 and below Regexp.send(:include, CoreExtensions::Regexp::Examples)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
regexp-examples-1.1.3 | lib/core_extensions/regexp/examples.rb |
regexp-examples-1.1.2 | lib/core_extensions/regexp/examples.rb |