class RSpec::Core::Formatters::BaseFormatter

def self.relative_path(line)

def self.relative_path(line)
  line = line.sub(File.expand_path("."), ".")
  line = line.sub(/\A([^:]+:\d+)$/, '\\1')
  return nil if line == '-e:1'
  line
end

def backtrace_line(line)

def backtrace_line(line)
  return nil if configuration.cleaned_from_backtrace?(line)
  self.class.relative_path(line)
end

def close

This method is invoked at the very end. Allows the formatter to clean up, like closing open streams.
def close
  restore_sync_output
end

def color_enabled?

def color_enabled?
  configuration.color_enabled?
end

def configuration

def configuration
  RSpec.configuration
end

def dump_failures

Dumps detailed information about each example failure.
def dump_failures
end

def dump_pending

This gets invoked after the summary if option is set to do so.
def dump_pending
end

def dump_summary(duration, example_count, failure_count, pending_count)

This method is invoked after the dumping of examples and failures.
def dump_summary(duration, example_count, failure_count, pending_count)
  @duration = duration
  @example_count = example_count
  @failure_count = failure_count
  @pending_count = pending_count
end

def example_failed(example)

def example_failed(example)
  @failed_examples << example
end

def example_group_finished(example_group)

+example_group+ is the example_group.
This method is invoked at the end of the execution of each example group.
def example_group_finished(example_group)
end

def example_group_started(example_group)

+example_pending+, or +example_finished+
The next method to be invoked after this is +example_passed+,

+example_group+ is the example_group.
This method is invoked at the beginning of the execution of each example group.
def example_group_started(example_group)
  @example_group = example_group
end

def example_passed(example)

def example_passed(example)
end

def example_pending(example)

def example_pending(example)
  @pending_examples << example
end

def example_started(example)

def example_started(example)
  examples << example
end

def find_failed_line(backtrace, path)

def find_failed_line(backtrace, path)
  backtrace.detect { |line|
    match = line.match(/(.+?):(\d+)(|:\d+)/)
    match && match[1].downcase == path.downcase
  }
end

def format_backtrace(backtrace, example)

def format_backtrace(backtrace, example)
  return "" unless backtrace
  return backtrace if example.metadata[:full_backtrace] == true
  if at_exit_index = backtrace.index(RSpec::Core::Runner::AT_EXIT_HOOK_BACKTRACE_LINE)
    backtrace = backtrace[0, at_exit_index]
  end
  cleansed = backtrace.map { |line| backtrace_line(line) }.compact
  cleansed.empty? ? backtrace : cleansed
end

def initialize(output)

def initialize(output)
  @output = output || StringIO.new
  @example_count = @pending_count = @failure_count = 0
  @examples = []
  @failed_examples = []
  @pending_examples = []
  @example_group = nil
end

def message(message)

def message(message)
end

def output_supports_sync

def output_supports_sync
  output.respond_to?(:sync=)
end

def profile_examples?

def profile_examples?
  configuration.profile_examples
end

def read_failed_line(exception, example)

def read_failed_line(exception, example)
  unless matching_line = find_failed_line(exception.backtrace, example.file_path)
    return "Unable to find matching line from backtrace"
  end
  file_path, line_number = matching_line.match(/(.+?):(\d+)(|:\d+)/)[1..2]
  if File.exist?(file_path)
    File.readlines(file_path)[line_number.to_i - 1]
  else
    "Unable to find #{file_path} to read failed line"
  end
end

def restore_sync_output

def restore_sync_output
  output.sync = @old_sync if output_supports_sync and !output.closed?
end

def seed(number)

def seed(number)
end

def start(example_count)

is #example_group_started
This will only be invoked once, and the next one to be invoked

formatters that need to provide progress on feedback (graphical ones)
they have all been collected. This can be useful for special
This method is invoked before any examples are run, right after
def start(example_count)
  start_sync_output
  @example_count = example_count
end

def start_dump

to be invoked after this one is #dump_failure (once for each failed example),
This method is invoked after all of the examples have executed. The next method
def start_dump
end

def start_sync_output

def start_sync_output
  @old_sync, output.sync = output.sync, true if output_supports_sync
end

def stop

def stop
end