Sha256: 9985fe919bfc84903cab62ed270a7c7de0e513b4ff4b77a55cd1382786337009

Contents?: true

Size: 432 Bytes

Versions: 1

Compression:

Stored size: 432 Bytes

Contents

require "json"

class Xccov
  class Parse
    attr_reader :data

    def initialize(file: nil, json: nil)
      @data = JSON.parse(json) if json
      @data = JSON.parse(File.read(file)) if file
    end

    def targets_name
      @data.map { |data| data["name"] }
    end

    def targets_line_coverage
      @data.reduce({}) do |memo, data|
        memo.merge({ data["name"] => data["lineCoverage"] })
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xccov-parse-0.2.0 lib/xccov-parse/parse.rb