Class: RSpec::Bisect::Result
- Inherits:
-
Struct
- Object
- Struct
- RSpec::Bisect::Result
- Defined in:
- lib/rspec/bisect/result.rb
Defined Under Namespace
Classes: ParserError
Instance Attribute Summary collapse
-
#result_string ⇒ Object
Returns the value of attribute result_string.
Instance Method Summary collapse
Instance Attribute Details
#result_string ⇒ Object
Returns the value of attribute result_string
3 4 5 |
# File 'lib/rspec/bisect/result.rb', line 3 def result_string @result_string end |
Instance Method Details
#as_json ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/rspec/bisect/result.rb', line 6 def as_json parsed_lines = result_string.split("\n").lazy.map do |line| begin JSON.parse line rescue JSON::ParserError #ignored end end parsed_result = parsed_lines.reject { |result| result.nil? }.first parsed_result || raise(ParserError.new('Could not parse json')) end |