module RSpec::Core::Metadata

def self.ascend(metadata)

Other tags:
    Private: -
def self.ascend(metadata)
  enum_for(:ascending, metadata)
end

def self.ascending(metadata)

Other tags:
    Private: -
def self.ascending(metadata)
  yield metadata
  return unless (group_metadata = metadata.fetch(:example_group) { metadata[:parent_example_group] })
  loop do
    yield group_metadata
    break unless (group_metadata = group_metadata[:parent_example_group])
  end
end

def self.build_hash_from(args, warn_about_example_group_filtering=false)

Other tags:
    Private: -
def self.build_hash_from(args, warn_about_example_group_filtering=false)
  hash = args.last.is_a?(Hash) ? args.pop : {}
  hash[args.pop] = true while args.last.is_a?(Symbol)
  if warn_about_example_group_filtering && hash.key?(:example_group)
    RSpec.deprecate("Filtering by an `:example_group` subhash",
                    :replacement => "the subhash to filter directly")
  end
  hash
end

def self.deep_hash_dup(object)

Other tags:
    Private: -
def self.deep_hash_dup(object)
  return object.dup if Array === object
  return object unless Hash  === object
  object.inject(object.dup) do |duplicate, (key, value)|
    duplicate[key] = deep_hash_dup(value)
    duplicate
  end
end

def self.id_from(metadata)

Other tags:
    Private: -
def self.id_from(metadata)
  "#{metadata[:rerun_file_path]}[#{metadata[:scoped_id]}]"
end

def self.location_tuple_from(metadata)

Other tags:
    Private: -
def self.location_tuple_from(metadata)
  [metadata[:absolute_file_path], metadata[:line_number]]
end

def self.relative_path(line)

Returns:
  • (String) - relative path to line

Parameters:
  • line (String) -- current code line

Other tags:
    Api: - private
def self.relative_path(line)
  line = line.sub(relative_path_regex, "\\1.\\2".freeze)
  line = line.sub(/\A([^:]+:\d+)$/, '\\1'.freeze)
  return nil if line == '-e:1'.freeze
  line
rescue SecurityError
  # :nocov:
  nil
  # :nocov:
end

def self.relative_path_regex

http://rubular.com/r/sbAMHFrOx1
http://rubular.com/r/duOrD4i3wb
http://rubular.com/r/fT0gmX6VJX

before and the character after the string if any.
separator, or at the end of the string. Match groups are the character
whitespace, containing the current path, either postfixed with the
Matches strings either at the beginning of the input or prefixed with a
def self.relative_path_regex
  @relative_path_regex ||= /(\A|\s)#{File.expand_path('.')}(#{File::SEPARATOR}|\s|\Z)/
end