Class: Commit
Instance Attribute Summary collapse
-
#addition ⇒ Object
Time calc.
-
#clocked_in ⇒ Object
Whether it’s been padded by a clock in/out.
-
#clocked_out ⇒ Object
Whether it’s been padded by a clock in/out.
-
#diffs ⇒ Object
From Grit::Commit object.
-
#estimated ⇒ Object
Time calc.
-
#message ⇒ Object
From Grit::Commit object.
-
#minutes ⇒ Object
Time calc.
-
#overriden ⇒ Object
Time calc.
-
#sha ⇒ Object
From Grit::Commit object.
Attributes inherited from Record
Instance Method Summary collapse
-
#initialize(commit = nil, date = nil, paths = nil) ⇒ Commit
constructor
A new instance of Commit.
Constructor Details
#initialize(commit = nil, date = nil, paths = nil) ⇒ Commit
Returns a new instance of Commit.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/record.rb', line 13 def initialize(commit = nil, date = nil, paths = nil) @addition = 0 @date = date if commit @author = commit.[:email] @date = commit.time @message = commit..gsub("\n",' ') @sha = commit.oid @diffs = 0 commit.diff(commit.parents[0]).each_patch do |patch| # Weight deletions half as much, since they are typically # faster to do & also are 1:1 with additions when changing a line @diffs += patch.stat[0] + patch.stat[1]/2 end end end |
Instance Attribute Details
#addition ⇒ Object
Time calc
9 10 11 |
# File 'lib/record.rb', line 9 def addition @addition end |
#clocked_in ⇒ Object
Whether it’s been padded by a clock in/out
11 12 13 |
# File 'lib/record.rb', line 11 def clocked_in @clocked_in end |
#clocked_out ⇒ Object
Whether it’s been padded by a clock in/out
11 12 13 |
# File 'lib/record.rb', line 11 def clocked_out @clocked_out end |
#diffs ⇒ Object
From Grit::Commit object
7 8 9 |
# File 'lib/record.rb', line 7 def diffs @diffs end |
#estimated ⇒ Object
Time calc
9 10 11 |
# File 'lib/record.rb', line 9 def estimated @estimated end |
#message ⇒ Object
From Grit::Commit object
7 8 9 |
# File 'lib/record.rb', line 7 def @message end |
#minutes ⇒ Object
Time calc
9 10 11 |
# File 'lib/record.rb', line 9 def minutes @minutes end |
#overriden ⇒ Object
Time calc
9 10 11 |
# File 'lib/record.rb', line 9 def overriden @overriden end |
#sha ⇒ Object
From Grit::Commit object
7 8 9 |
# File 'lib/record.rb', line 7 def sha @sha end |