class RSpec::Core::SharedExampleGroup::Registry

def add(context, name, *metadata_args, &block)

def add(context, name, *metadata_args, &block)
  unless block
    RSpec.warning "Shared example group #{name} was defined without a "\
                  "block and will have no effect. Please define a "\
                  "block or remove the definition."
  end
  if RSpec.configuration.shared_context_metadata_behavior == :trigger_inclusion
    return legacy_add(context, name, *metadata_args, &block)
  end
  unless valid_name?(name)
    raise ArgumentError, "Shared example group names can only be a string, " \
                         "symbol or module but got: #{name.inspect}"
  end
  ensure_block_has_source_location(block) { CallerFilter.first_non_rspec_line }
  warn_if_key_taken context, name, block
  metadata = Metadata.build_hash_from(metadata_args)
  shared_module = SharedExampleGroupModule.new(name, block, metadata)
  shared_example_groups[context][name] = shared_module
end