Sha256: c0d3f5f64094de7668c0ff8040dbf9da622172ecb2379c38c580e4f8d397703c

Contents?: true

Size: 431 Bytes

Versions: 2

Compression:

Stored size: 431 Bytes

Contents

module SimpleCovLinterFormatter
  class JsonResultExporter
    def initialize(result_hash)
      @result = result_hash
    end

    def export
      File.open(export_path, 'w') do |file|
        file << json_result
      end
    end

    private

    def json_result
      JSON.pretty_generate(@result)
    end

    def export_path
      File.join(SimpleCov.coverage_path, SimpleCovLinterFormatter.json_filename)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simplecov_linter_formatter-0.2.0 lib/simplecov_linter_formatter/exporters/json_result_exporter.rb
simplecov_linter_formatter-0.1.0 lib/simplecov_linter_formatter/exporters/json_result_exporter.rb