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
# File 'lib/core_extensions/regexp/examples.rb', line 7

def examples(**config_options)
  RegexpExamples::Config.with_configuration(**config_options) do
    examples_by_method(:result)
  end
end

#random_example(**config_options) ⇒ Object



13
14
15
16
17
# File 'lib/core_extensions/regexp/examples.rb', line 13

def random_example(**config_options)
  RegexpExamples::Config.with_configuration(**config_options) do
    examples_by_method(:random_result).sample
  end
end