Class: RailsDoctor::Coverage
- Inherits:
-
Struct
- Object
- Struct
- RailsDoctor::Coverage
- Defined in:
- lib/rails_doctor/models.rb
Instance Attribute Summary collapse
-
#available ⇒ Object
Returns the value of attribute available.
-
#branch_percent ⇒ Object
Returns the value of attribute branch_percent.
-
#changed_files_below_threshold ⇒ Object
Returns the value of attribute changed_files_below_threshold.
-
#covered_branches ⇒ Object
Returns the value of attribute covered_branches.
-
#covered_lines ⇒ Object
Returns the value of attribute covered_lines.
-
#line_percent ⇒ Object
Returns the value of attribute line_percent.
-
#low_file_count ⇒ Object
Returns the value of attribute low_file_count.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#missed_branches ⇒ Object
Returns the value of attribute missed_branches.
-
#missed_lines ⇒ Object
Returns the value of attribute missed_lines.
-
#report_path ⇒ Object
Returns the value of attribute report_path.
-
#source ⇒ Object
Returns the value of attribute source.
-
#status ⇒ Object
Returns the value of attribute status.
-
#thresholds ⇒ Object
Returns the value of attribute thresholds.
-
#top_files ⇒ Object
Returns the value of attribute top_files.
-
#total_branches ⇒ Object
Returns the value of attribute total_branches.
-
#total_lines ⇒ Object
Returns the value of attribute total_lines.
Instance Method Summary collapse
-
#initialize(**kwargs) ⇒ Coverage
constructor
A new instance of Coverage.
- #summary ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(**kwargs) ⇒ Coverage
Returns a new instance of Coverage.
164 165 166 167 168 169 170 171 |
# File 'lib/rails_doctor/models.rb', line 164 def initialize(**kwargs) super self.available = false if available.nil? self.thresholds ||= {} self.top_files ||= [] self.changed_files_below_threshold ||= [] self. ||= {} end |
Instance Attribute Details
#available ⇒ Object
Returns the value of attribute available
144 145 146 |
# File 'lib/rails_doctor/models.rb', line 144 def available @available end |
#branch_percent ⇒ Object
Returns the value of attribute branch_percent
144 145 146 |
# File 'lib/rails_doctor/models.rb', line 144 def branch_percent @branch_percent end |
#changed_files_below_threshold ⇒ Object
Returns the value of attribute changed_files_below_threshold
144 145 146 |
# File 'lib/rails_doctor/models.rb', line 144 def changed_files_below_threshold @changed_files_below_threshold end |
#covered_branches ⇒ Object
Returns the value of attribute covered_branches
144 145 146 |
# File 'lib/rails_doctor/models.rb', line 144 def covered_branches @covered_branches end |
#covered_lines ⇒ Object
Returns the value of attribute covered_lines
144 145 146 |
# File 'lib/rails_doctor/models.rb', line 144 def covered_lines @covered_lines end |
#line_percent ⇒ Object
Returns the value of attribute line_percent
144 145 146 |
# File 'lib/rails_doctor/models.rb', line 144 def line_percent @line_percent end |
#low_file_count ⇒ Object
Returns the value of attribute low_file_count
144 145 146 |
# File 'lib/rails_doctor/models.rb', line 144 def low_file_count @low_file_count end |
#metadata ⇒ Object
Returns the value of attribute metadata
144 145 146 |
# File 'lib/rails_doctor/models.rb', line 144 def @metadata end |
#missed_branches ⇒ Object
Returns the value of attribute missed_branches
144 145 146 |
# File 'lib/rails_doctor/models.rb', line 144 def missed_branches @missed_branches end |
#missed_lines ⇒ Object
Returns the value of attribute missed_lines
144 145 146 |
# File 'lib/rails_doctor/models.rb', line 144 def missed_lines @missed_lines end |
#report_path ⇒ Object
Returns the value of attribute report_path
144 145 146 |
# File 'lib/rails_doctor/models.rb', line 144 def report_path @report_path end |
#source ⇒ Object
Returns the value of attribute source
144 145 146 |
# File 'lib/rails_doctor/models.rb', line 144 def source @source end |
#status ⇒ Object
Returns the value of attribute status
144 145 146 |
# File 'lib/rails_doctor/models.rb', line 144 def status @status end |
#thresholds ⇒ Object
Returns the value of attribute thresholds
144 145 146 |
# File 'lib/rails_doctor/models.rb', line 144 def thresholds @thresholds end |
#top_files ⇒ Object
Returns the value of attribute top_files
144 145 146 |
# File 'lib/rails_doctor/models.rb', line 144 def top_files @top_files end |
#total_branches ⇒ Object
Returns the value of attribute total_branches
144 145 146 |
# File 'lib/rails_doctor/models.rb', line 144 def total_branches @total_branches end |
#total_lines ⇒ Object
Returns the value of attribute total_lines
144 145 146 |
# File 'lib/rails_doctor/models.rb', line 144 def total_lines @total_lines end |
Instance Method Details
#summary ⇒ Object
173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/rails_doctor/models.rb', line 173 def summary { available: available, status: status, source: source, line_percent: line_percent, branch_percent: branch_percent, thresholds: thresholds, low_file_count: low_file_count || top_files.count { |file| file[:below_threshold] }, changed_file_low_count: changed_files_below_threshold.size }.compact end |
#to_h ⇒ Object
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/rails_doctor/models.rb', line 186 def to_h { available: available, status: status, source: source, report_path: report_path, line_percent: line_percent, branch_percent: branch_percent, covered_lines: covered_lines, missed_lines: missed_lines, total_lines: total_lines, covered_branches: covered_branches, missed_branches: missed_branches, total_branches: total_branches, thresholds: thresholds, top_files: top_files, low_file_count: low_file_count, changed_files_below_threshold: changed_files_below_threshold, metadata: }.compact end |