Class: Git::Lint::Collector
- Inherits:
-
Object
- Object
- Git::Lint::Collector
- Defined in:
- lib/git/lint/collector.rb
Overview
Collects and categorizes, by severity, all issues (if any).
Instance Method Summary collapse
- #add(analyzer) ⇒ Object
- #clear ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(model: Models::Total) ⇒ Collector
constructor
A new instance of Collector.
- #retrieve(id) ⇒ Object
- #to_h ⇒ Object
- #total ⇒ Object
Constructor Details
Instance Method Details
#add(analyzer) ⇒ Object
12 13 14 15 |
# File 'lib/git/lint/collector.rb', line 12 def add analyzer collection[analyzer.commit] << analyzer analyzer end |
#clear ⇒ Object
30 |
# File 'lib/git/lint/collector.rb', line 30 def clear = collection.clear && self |
#empty? ⇒ Boolean
32 |
# File 'lib/git/lint/collector.rb', line 32 def empty? = collection.empty? |
#retrieve(id) ⇒ Object
28 |
# File 'lib/git/lint/collector.rb', line 28 def retrieve(id) = collection[id] |
#to_h ⇒ Object
34 |
# File 'lib/git/lint/collector.rb', line 34 def to_h = collection |
#total ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/git/lint/collector.rb', line 17 def total values = collection.values.flatten model[ items: collection.keys.compact.size, issues: values.count(&:invalid?), warnings: values.count(&:warning?), errors: values.count(&:error?) ] end |