You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: example_group.rb
    path of file: ./repos/rspec-core/lib/rspec/core
    
    the code of the file until where you have to start completion: RSpec::Support.require_rspec_support 'recursive_const_methods'

module RSpec
  module Core
    # rubocop:disable Metrics/ClassLength

    # ExampleGroup and {Example} are the main structural elements of
    # rspec-core. Consider this example:
    
    
      def self.define_example_group_method(name, metadata={})
        idempotently_define_singleton_method(name) do |*args, &example_group_block|
          thread_data = RSpec::Support.thread_local_data
          top_level   = self == ExampleGroup

          registration_collection =
            if top_level
              if thread_data[:in_example_group]
                raise "Creating an isolated context from within a context is " \
                      "not allowed. Change `RSpec.#{name}` to `#{name}` or " \
                      "move this to a top-level scope."
              end

              thread_data[:in_example_group] = true
              RSpec.world.example_groups
            else
              children
            end