Class: RSpec::Bisect::Result

Inherits:
Struct
  • Object
show all
Defined in:
lib/rspec/bisect/result.rb

Defined Under Namespace

Classes: ParserError

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#result_stringObject

Returns the value of attribute result_string

Returns:

  • (Object)

    the current value of result_string


3
4
5
# File 'lib/rspec/bisect/result.rb', line 3

def result_string
  @result_string
end

Instance Method Details

#as_jsonObject


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