class Bake::Modernize::License::SkipList

Represents revisions to skip when analyzing authorship.

def self.for(root)

Load the skip list from a directory.
def self.for(root)
	full_path = File.join(root, GIT_BLAME_IGNORE_REVS)
	
	if File.exist?(full_path)
		skip_list = self.new
		skip_list.extract(full_path)
		return skip_list
	end
end

def extract(path)

Extract the revisions from the given path.
def extract(path)
	File.open(path, "r") do |file|
		file.each_line do |line|
			# Skip empty lines and comments
			next if line =~ /^\s*(#|$)/
			# Parse line
			@revisions << line.strip
		end
	end
end

def ignore?(commit)

Check if the given commit should be ignored.
def ignore?(commit)
	@revisions.include?(commit.oid)
end

def initialize(revisions = [])

@parameter revisions [Array(String)] The revisions to skip.

Create a new skip list with the given revisions.
def initialize(revisions = [])
	@revisions = Set.new(revisions)
end