Class: RSpec::Core::ExampleStatusParser

Inherits:
Object
  • Object
show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/example_status_persister.rb

Overview

Parses a string that has been previously dumped by ExampleStatusDumper. Note that this parser is a bit naive in that it does a simple split on “n” and “ | ”, with no concern for handling escaping. For now, that’s OK because the values we plan to persist (example id, status, and perhaps example duration) are highly unlikely to contain “n” or “ | ” – after all, who puts those in file names?

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string) ⇒ ExampleStatusParser

Returns a new instance of ExampleStatusParser.



212
213
214
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/example_status_persister.rb', line 212

def initialize(string)
  @header_line, _, *@row_lines = string.lines.to_a
end

Class Method Details

.parse(string) ⇒ Object



208
209
210
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/example_status_persister.rb', line 208

def self.parse(string)
  new(string).parse
end

Instance Method Details

#parseObject



216
217
218
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/example_status_persister.rb', line 216

def parse
  @row_lines.map { |line| parse_row(line) }
end