Class: Bringit::CommitStats
- Inherits:
-
Object
- Object
- Bringit::CommitStats
- Defined in:
- lib/bringit/commit_stats.rb
Instance Attribute Summary collapse
-
#additions ⇒ Object
readonly
Returns the value of attribute additions.
-
#deletions ⇒ Object
readonly
Returns the value of attribute deletions.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
-
#initialize(commit) ⇒ CommitStats
constructor
Instantiate a CommitStats object.
Constructor Details
#initialize(commit) ⇒ CommitStats
Instantiate a CommitStats object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/bringit/commit_stats.rb', line 8 def initialize(commit) @id = commit.id @additions = 0 @deletions = 0 @total = 0 diff = commit.diff_from_parent diff.each_patch do |p| # TODO: Use the new Rugged convenience methods when they're released @additions += p.stat[0] @deletions += p.stat[1] @total += p.changes end end |
Instance Attribute Details
#additions ⇒ Object (readonly)
Returns the value of attribute additions.
5 6 7 |
# File 'lib/bringit/commit_stats.rb', line 5 def additions @additions end |
#deletions ⇒ Object (readonly)
Returns the value of attribute deletions.
5 6 7 |
# File 'lib/bringit/commit_stats.rb', line 5 def deletions @deletions end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/bringit/commit_stats.rb', line 5 def id @id end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
5 6 7 |
# File 'lib/bringit/commit_stats.rb', line 5 def total @total end |