Class: Coverband::Utils::HTMLFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/coverband/utils/html_formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(report, options = {}) ⇒ HTMLFormatter

Returns a new instance of HTMLFormatter.



18
19
20
21
22
23
24
# File 'lib/coverband/utils/html_formatter.rb', line 18

def initialize(report, options = {})
  @notice = options.fetch(:notice, nil)
  @base_path = options.fetch(:base_path, "./")
  @tracker = options.fetch(:tracker, nil)
  @page = options.fetch(:page, nil)
  @coverage_result = Coverband::Utils::Results.new(report) if report
end

Instance Attribute Details

#base_pathObject (readonly)

Returns the value of attribute base_path.



16
17
18
# File 'lib/coverband/utils/html_formatter.rb', line 16

def base_path
  @base_path
end

#noticeObject (readonly)

Returns the value of attribute notice.



16
17
18
# File 'lib/coverband/utils/html_formatter.rb', line 16

def notice
  @notice
end

#pageObject (readonly)

Returns the value of attribute page.



16
17
18
# File 'lib/coverband/utils/html_formatter.rb', line 16

def page
  @page
end

#trackerObject (readonly)

Returns the value of attribute tracker.



16
17
18
# File 'lib/coverband/utils/html_formatter.rb', line 16

def tracker
  @tracker
end

Instance Method Details

#format_abstract_tracker!Object



38
39
40
# File 'lib/coverband/utils/html_formatter.rb', line 38

def format_abstract_tracker!
  template("abstract_tracker").result(binding)
end

#format_dynamic_data!Object



30
31
32
# File 'lib/coverband/utils/html_formatter.rb', line 30

def format_dynamic_data!
  format_data(@coverage_result)
end

#format_dynamic_html!Object



26
27
28
# File 'lib/coverband/utils/html_formatter.rb', line 26

def format_dynamic_html!
  format_html(@coverage_result)
end

#format_settings!Object



34
35
36
# File 'lib/coverband/utils/html_formatter.rb', line 34

def format_settings!
  format_settings
end

#format_source_file!(filename) ⇒ Object



42
43
44
45
46
47
48
49
50
# File 'lib/coverband/utils/html_formatter.rb', line 42

def format_source_file!(filename)
  source_file = @coverage_result.file_from_path_with_type(filename)

  if source_file
    formatted_source_file(@coverage_result, source_file)
  else
    "File No Longer Available"
  end
end