Class: PmdTester::RunningDiffCounters
- Inherits:
-
Object
- Object
- PmdTester::RunningDiffCounters
- Defined in:
- lib/pmdtester/report_diff.rb
Overview
A bunch of counters to summarize differences
Instance Attribute Summary collapse
-
#base_total ⇒ Object
Returns the value of attribute base_total.
-
#changed ⇒ Object
Returns the value of attribute changed.
-
#new ⇒ Object
Returns the value of attribute new.
-
#patch_total ⇒ Object
Returns the value of attribute patch_total.
-
#removed ⇒ Object
Returns the value of attribute removed.
Instance Method Summary collapse
- #changed_total ⇒ Object
-
#initialize(base_total) ⇒ RunningDiffCounters
constructor
A new instance of RunningDiffCounters.
- #merge!(other) ⇒ Object
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(base_total) ⇒ RunningDiffCounters
Returns a new instance of RunningDiffCounters.
8 9 10 11 12 13 |
# File 'lib/pmdtester/report_diff.rb', line 8 def initialize(base_total) @base_total = base_total @patch_total = 0 @new = @removed = @changed = 0 end |
Instance Attribute Details
#base_total ⇒ Object
Returns the value of attribute base_total.
6 7 8 |
# File 'lib/pmdtester/report_diff.rb', line 6 def base_total @base_total end |
#changed ⇒ Object
Returns the value of attribute changed.
6 7 8 |
# File 'lib/pmdtester/report_diff.rb', line 6 def changed @changed end |
#new ⇒ Object
Returns the value of attribute new.
6 7 8 |
# File 'lib/pmdtester/report_diff.rb', line 6 def new @new end |
#patch_total ⇒ Object
Returns the value of attribute patch_total.
6 7 8 |
# File 'lib/pmdtester/report_diff.rb', line 6 def patch_total @patch_total end |
#removed ⇒ Object
Returns the value of attribute removed.
6 7 8 |
# File 'lib/pmdtester/report_diff.rb', line 6 def removed @removed end |
Instance Method Details
#changed_total ⇒ Object
15 16 17 |
# File 'lib/pmdtester/report_diff.rb', line 15 def changed_total new + removed + changed end |
#merge!(other) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/pmdtester/report_diff.rb', line 19 def merge!(other) self.changed += other.changed self.new += other.new self.removed += other.removed self.base_total += other.base_total self.patch_total += other.patch_total end |
#to_h ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/pmdtester/report_diff.rb', line 27 def to_h { changed: changed, new: new, removed: removed, base_total: base_total, patch_total: patch_total } end |
#to_s ⇒ Object
37 38 39 |
# File 'lib/pmdtester/report_diff.rb', line 37 def to_s "RunningDiffCounters[#{to_h}]" end |