Class: SimpleCov::Formatter::JSONFormatter::ResultExporter
| Relationships & Source Files | |
| Inherits: | Object |
| Defined in: | lib/simplecov/formatter/json_formatter/result_exporter.rb |
Constant Summary
-
FILENAME =
# File 'lib/simplecov/formatter/json_formatter/result_exporter.rb', line 7"coverage.json"
Class Method Summary
- .new(result_hash) ⇒ ResultExporter constructor
Instance Method Summary
- #export
- #export_path private
- #json_result private
Constructor Details
.new(result_hash) ⇒ ResultExporter
# 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