Class: RSpec::Core::ExampleStatusParser Private
Do not use. This class is for internal use only.
Relationships & Source Files | |
Inherits: | Object |
Defined in: | rspec-core/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
- .new(string) ⇒ ExampleStatusParser constructor Internal use only
- .parse(string) Internal use only
Instance Method Summary
- #parse Internal use only
- #headers private Internal use only
- #parse_row(line) private Internal use only
- #split_line(line) private Internal use only
Class Method Details
.parse(string)
[ GitHub ]# File 'rspec-core/lib/rspec/core/example_status_persister.rb', line 208
def self.parse(string) new(string).parse end
Instance Method Details
#headers (private)
[ GitHub ]# File 'rspec-core/lib/rspec/core/example_status_persister.rb', line 226
def headers @headers ||= split_line(@header_line).grep(/\S/).map(&:to_sym) end
#parse
[ GitHub ]# File 'rspec-core/lib/rspec/core/example_status_persister.rb', line 216
def parse @row_lines.map { |line| parse_row(line) } end
#parse_row(line) (private)
[ GitHub ]# File 'rspec-core/lib/rspec/core/example_status_persister.rb', line 222
def parse_row(line) Hash[headers.zip(split_line(line))] end
#split_line(line) (private)
[ GitHub ]# File 'rspec-core/lib/rspec/core/example_status_persister.rb', line 230
def split_line(line) line.split(/\s+\|\s+?/, -1) end