class Git::Cop::Collector

Attributes

collection[R]

Public Class Methods

new() click to toggle source
# File lib/git/cop/collector.rb, line 10
def initialize
  @collection = Hash.new { |default, missing_id| default[missing_id] = [] }
end

Public Instance Methods

add(cop) click to toggle source
# File lib/git/cop/collector.rb, line 14
def add cop
  collection[cop.commit] << cop
  cop
end
empty?() click to toggle source
# File lib/git/cop/collector.rb, line 23
def empty?
  collection.empty?
end
errors?() click to toggle source
# File lib/git/cop/collector.rb, line 31
def errors?
  collection.values.flatten.any?(&:error?)
end
issues?() click to toggle source
# File lib/git/cop/collector.rb, line 35
def issues?
  collection.values.flatten.any?(&:invalid?)
end
retrieve(id) click to toggle source
# File lib/git/cop/collector.rb, line 19
def retrieve id
  collection[id]
end
to_h() click to toggle source
# File lib/git/cop/collector.rb, line 55
def to_h
  collection
end
total_commits() click to toggle source
# File lib/git/cop/collector.rb, line 51
def total_commits
  collection.keys.size
end
total_errors() click to toggle source
# File lib/git/cop/collector.rb, line 43
def total_errors
  collection.values.flatten.select(&:error?).size
end
total_issues() click to toggle source
# File lib/git/cop/collector.rb, line 47
def total_issues
  collection.values.flatten.select(&:invalid?).size
end
total_warnings() click to toggle source
# File lib/git/cop/collector.rb, line 39
def total_warnings
  collection.values.flatten.select(&:warning?).size
end
warnings?() click to toggle source
# File lib/git/cop/collector.rb, line 27
def warnings?
  collection.values.flatten.any?(&:warning?)
end