Class: Author

Inherits:
Object
  • Object
show all
Defined in:
lib/ginbeer/author.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, commit_count) ⇒ Author

Returns a new instance of Author.



4
5
6
7
8
9
# File 'lib/ginbeer/author.rb', line 4

def initialize(name, commit_count)
  @name = name
  @commit_count = commit_count 
  @insertion = 0
  @deletion = 0
end

Instance Attribute Details

#commit_countObject

Returns the value of attribute commit_count.



2
3
4
# File 'lib/ginbeer/author.rb', line 2

def commit_count
  @commit_count
end

#deletionObject

Returns the value of attribute deletion.



2
3
4
# File 'lib/ginbeer/author.rb', line 2

def deletion
  @deletion
end

#insertionObject

Returns the value of attribute insertion.



2
3
4
# File 'lib/ginbeer/author.rb', line 2

def insertion
  @insertion
end

#nameObject

Returns the value of attribute name.



2
3
4
# File 'lib/ginbeer/author.rb', line 2

def name
  @name
end

Instance Method Details

#resultObject



15
16
17
# File 'lib/ginbeer/author.rb', line 15

def result
  return "#{self.name}: #{self.score}(commits: #{self.commit_count}, insertion: #{self.insertion}, deletion: #{self.deletion})"
end

#scoreObject



11
12
13
# File 'lib/ginbeer/author.rb', line 11

def score
  return @commit_count + @insertion + @deletion
end