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
25
26
# 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)
  @used_keys_sort = options.fetch(:used_keys_sort, nil)
  @sorted_used_keys = options.fetch(:sorted_used_keys, 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

#sorted_used_keysObject (readonly)

Returns the value of attribute sorted_used_keys.



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

def sorted_used_keys
  @sorted_used_keys
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

#used_keys_sortObject (readonly)

Returns the value of attribute used_keys_sort.



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

def used_keys_sort
  @used_keys_sort
end

Instance Method Details

#format_abstract_tracker!Object



40
41
42
# File 'lib/coverband/utils/html_formatter.rb', line 40

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

#format_dynamic_data!Object



32
33
34
# File 'lib/coverband/utils/html_formatter.rb', line 32

def format_dynamic_data!
  format_data(@coverage_result)
end

#format_dynamic_html!Object



28
29
30
# File 'lib/coverband/utils/html_formatter.rb', line 28

def format_dynamic_html!
  format_html(@coverage_result)
end

#format_settings!Object



36
37
38
# File 'lib/coverband/utils/html_formatter.rb', line 36

def format_settings!
  format_settings
end

#format_source_file!(filename) ⇒ Object



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

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