Class: Jscov::Coverage

Inherits:
Object
  • Object
show all
Defined in:
lib/jscov/coverage.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_data) ⇒ Coverage

Returns a new instance of Coverage.



5
6
7
# File 'lib/jscov/coverage.rb', line 5

def initialize(raw_data)
  @raw_data = raw_data
end

Class Method Details

.new_coverage_file_pathObject



16
17
18
19
# File 'lib/jscov/coverage.rb', line 16

def new_coverage_file_path
  name = "jscov_#{Time.now.to_i}_#{SecureRandom.uuid}.json"
  Jscov.configuration.coverage_report_dir_path.join(name)
end

Instance Method Details

#saveObject



9
10
11
12
13
# File 'lib/jscov/coverage.rb', line 9

def save
  File.open(self.class.new_coverage_file_path, "w") do |f|
    f.puts @raw_data.to_json
  end
end