Class: Coverband::Reporters::HTMLReport

Inherits:
Base
  • Object
show all
Defined in:
lib/coverband/reporters/html_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 = {}) ⇒ HTMLReport

Returns a new instance of HTMLReport.



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

def initialize(store, options = {})
  self.page = options.fetch(:page) { nil }
  self.open_report = options.fetch(:open_report) { true }
  # TODO: refactor notice out to top level of web only
  self.notice = options.fetch(:notice) { nil }
  self.base_path = options.fetch(:base_path) { "./" }
  self.filename = options.fetch(:filename) { nil }

  coverband_reports = Coverband::Reporters::Base.report(store, options)
  # NOTE: at the moment the optimization around paging and filenames only works for hash redis store
  self.filtered_report_files = if (page || filename) && store.is_a?(Coverband::Adapters::HashRedisStore)
    coverband_reports
  else
    self.class.fix_reports(coverband_reports)
  end
end

Instance Attribute Details

#base_pathObject

Returns the value of attribute base_path.



6
7
8
# File 'lib/coverband/reporters/html_report.rb', line 6

def base_path
  @base_path
end

#filenameObject

Returns the value of attribute filename.



6
7
8
# File 'lib/coverband/reporters/html_report.rb', line 6

def filename
  @filename
end

#filtered_report_filesObject

Returns the value of attribute filtered_report_files.



6
7
8
# File 'lib/coverband/reporters/html_report.rb', line 6

def filtered_report_files
  @filtered_report_files
end

#noticeObject

Returns the value of attribute notice.



6
7
8
# File 'lib/coverband/reporters/html_report.rb', line 6

def notice
  @notice
end

#open_reportObject

Returns the value of attribute open_report.



6
7
8
# File 'lib/coverband/reporters/html_report.rb', line 6

def open_report
  @open_report
end

#pageObject

Returns the value of attribute page.



6
7
8
# File 'lib/coverband/reporters/html_report.rb', line 6

def page
  @page
end

Instance Method Details

#file_detailsObject



26
27
28
29
30
# File 'lib/coverband/reporters/html_report.rb', line 26

def file_details
  Coverband::Utils::HTMLFormatter.new(filtered_report_files,
    base_path: base_path,
    notice: notice).format_source_file!(filename)
end

#reportObject



32
33
34
# File 'lib/coverband/reporters/html_report.rb', line 32

def report
  report_dynamic_html
end

#report_dataObject



36
37
38
# File 'lib/coverband/reporters/html_report.rb', line 36

def report_data
  report_dynamic_data
end