git-timecost/lib/timecost/author_list.rb

25 lines
460 B
Ruby
Raw Normal View History

2014-09-24 18:11:05 +00:00
module TimeCost
class AuthorList
# Prepare an empty index (local)
def initialize
@count = 0
@store = {}
end
# Return local user id for git user
# FIXME: should handle multiple names for same user
def parse gitauthor
invert_store = @store.invert
result = 0
if invert_store.include? gitauthor then
result = invert_store[gitauthor]
else
@store[gitauthor] = @count
result = @count
@count += 1
end
end
end
end