class RSpec::Core::Metadata::ExampleGroupHash

@private

def self.backwards_compatibility_default_proc(&example_group_selector)

def self.backwards_compatibility_default_proc(&example_group_selector)
  Proc.new do |hash, key|
    case key
    when :example_group
      RSpec.deprecate("The `:example_group` key in an example group's metadata hash",
                      :replacement => "the example group's hash directly for the " +
                      "computed keys and `:parent_example_group` to access the parent " +
                      "example group metadata")
      LegacyExampleGroupHash.new(example_group_selector.call(hash))
    when :example_group_block
      RSpec.deprecate("`metadata[:example_group_block]`",
                      :replacement => "`metadata[:block]`")
      hash[:block]
    when :describes
      RSpec.deprecate("`metadata[:describes]`",
                      :replacement => "`metadata[:described_class]`")
      hash[:described_class]
    end
  end
end

def self.create(parent_group_metadata, user_metadata, *args, &block)

def self.create(parent_group_metadata, user_metadata, *args, &block)
  group_metadata = hash_with_backwards_compatibility_default_proc
  group_metadata.update(parent_group_metadata)
  group_metadata[:parent_example_group] = parent_group_metadata
  hash = new(group_metadata, user_metadata, args, block)
  hash.populate
  hash.metadata
end

def self.hash_with_backwards_compatibility_default_proc

def self.hash_with_backwards_compatibility_default_proc
  Hash.new(&backwards_compatibility_default_proc { |hash| hash })
end

def described_class

def described_class
  candidate = metadata[:description_args].first
  return candidate unless NilClass === candidate || String === candidate
  parent_group = metadata[:parent_example_group]
  parent_group && parent_group[:described_class]
end

def full_description

def full_description
  description          = metadata[:description]
  parent_example_group = metadata[:parent_example_group]
  parent_description   = parent_example_group[:full_description]
  return description unless parent_description
  separator = description_separator(parent_example_group[:description_args].last,
                                    metadata[:description_args].first)
  parent_description + separator + description
end