123456789_123456789_123456789_123456789_123456789_

Class: SimpleCov::Formatter::JSONFormatter::ResultExporter

Relationships & Source Files
Inherits: Object
Defined in: lib/simplecov/formatter/json_formatter/result_exporter.rb

Constant Summary

Class Method Summary

Instance Method Summary

Constructor Details

.new(result_hash) ⇒ ResultExporter

[ GitHub ]

  
# File 'lib/simplecov/formatter/json_formatter/result_exporter.rb', line 9

def initialize(result_hash)
  @result = result_hash
end

Instance Method Details

#export

[ GitHub ]

  
# File 'lib/simplecov/formatter/json_formatter/result_exporter.rb', line 13

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

#export_path (private)

[ GitHub ]

  
# File 'lib/simplecov/formatter/json_formatter/result_exporter.rb', line 25

def export_path
  File.join(SimpleCov.coverage_path, FILENAME)
end

#json_result (private)

[ GitHub ]

  
# File 'lib/simplecov/formatter/json_formatter/result_exporter.rb', line 21

def json_result
  JSON.pretty_generate(@result)
end