Class: RSpec::Core::ExampleStatusDumper

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/core/example_status_persister.rb

Overview

Dumps a list of hashes in a pretty, human readable format for later parsing. The hashes are expected to have symbol keys and string values, and each hash should have the same set of keys.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(examples) ⇒ ExampleStatusDumper

Returns a new instance of ExampleStatusDumper



148
149
150
# File 'lib/rspec/core/example_status_persister.rb', line 148

def initialize(examples)
  @examples = examples
end

Class Method Details

.dump(examples) ⇒ Object



144
145
146
# File 'lib/rspec/core/example_status_persister.rb', line 144

def self.dump(examples)
  new(examples).dump
end

Instance Method Details

#dumpObject



152
153
154
155
# File 'lib/rspec/core/example_status_persister.rb', line 152

def dump
  return nil if @examples.empty?
  (formatted_header_rows + formatted_value_rows).join("\n") << "\n"
end