Sha256: 58fe1c31c701d0f1eaf7240aec4fbd6546f58ddceeaaa55152b2352444c29241

Contents?: true

Size: 458 Bytes

Versions: 10

Compression:

Stored size: 458 Bytes

Contents

# frozen_string_literal: true

module SimpleCovJSONFormatter
  class ResultExporter
    FILENAME = 'coverage.json'

    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, FILENAME)
    end
  end
end

Version data entries

10 entries across 9 versions & 6 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/simplecov_json_formatter-0.1.4/lib/simplecov_json_formatter/result_exporter.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/simplecov_json_formatter-0.1.4/lib/simplecov_json_formatter/result_exporter.rb
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/simplecov_json_formatter-0.1.4/lib/simplecov_json_formatter/result_exporter.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/simplecov_json_formatter-0.1.4/lib/simplecov_json_formatter/result_exporter.rb
op_connect-0.1.2 vendor/bundle/ruby/3.1.0/gems/simplecov_json_formatter-0.1.4/lib/simplecov_json_formatter/result_exporter.rb
simplecov_json_formatter-0.1.4 lib/simplecov_json_formatter/result_exporter.rb
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/simplecov_json_formatter-0.1.3/lib/simplecov_json_formatter/result_exporter.rb
simplecov_json_formatter-0.1.3 lib/simplecov_json_formatter/result_exporter.rb
simplecov_json_formatter-0.1.2 lib/simplecov_json_formatter/result_exporter.rb
simplecov_json_formatter-0.1.0 lib/simplecov_json_formatter/result_exporter.rb