Class: Coverband::Reporters::JSONReport

Inherits:
Base
  • Object
show all
Defined in:
lib/coverband/reporters/json_report.rb

Constant Summary

Constants inherited from Base

Base::DATA_KEY

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

fix_reports, report

Constructor Details

#initialize(store, options = {}) ⇒ JSONReport

Returns a new instance of JSONReport.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/coverband/reporters/json_report.rb', line 10

def initialize(store, options = {})
  self.options = options
  self.page = options.fetch(:page) { nil }
  self.filename = options.fetch(:filename) { nil }
  self.as_report = options.fetch(:as_report) { false }
  self.base_path = options.fetch(:base_path) { "./" }
  self.store = store

  coverband_reports = Coverband::Reporters::Base.report(store, options)
  # NOTE: paged reports can't find and add in files that has never been loaded
  self.filtered_report_files = if page || filename
    coverband_reports
  else
    self.class.fix_reports(coverband_reports)
  end
end

Instance Attribute Details

#as_reportObject

Returns the value of attribute as_report.



8
9
10
# File 'lib/coverband/reporters/json_report.rb', line 8

def as_report
  @as_report
end

#base_pathObject

Returns the value of attribute base_path.



8
9
10
# File 'lib/coverband/reporters/json_report.rb', line 8

def base_path
  @base_path
end

#filenameObject

Returns the value of attribute filename.



8
9
10
# File 'lib/coverband/reporters/json_report.rb', line 8

def filename
  @filename
end

#filtered_report_filesObject

Returns the value of attribute filtered_report_files.



8
9
10
# File 'lib/coverband/reporters/json_report.rb', line 8

def filtered_report_files
  @filtered_report_files
end

#optionsObject

Returns the value of attribute options.



8
9
10
# File 'lib/coverband/reporters/json_report.rb', line 8

def options
  @options
end

#pageObject

Returns the value of attribute page.



8
9
10
# File 'lib/coverband/reporters/json_report.rb', line 8

def page
  @page
end

#storeObject

Returns the value of attribute store.



8
9
10
# File 'lib/coverband/reporters/json_report.rb', line 8

def store
  @store
end

Instance Method Details

#reportObject



27
28
29
# File 'lib/coverband/reporters/json_report.rb', line 27

def report
  report_as_json
end