Class: GitReport::Commit
- Inherits:
-
Object
- Object
- GitReport::Commit
- Defined in:
- lib/commit.rb
Instance Attribute Summary collapse
-
#commit ⇒ Object
Returns the value of attribute commit.
-
#project_identifier ⇒ Object
Returns the value of attribute project_identifier.
Instance Method Summary collapse
-
#author ⇒ Object
returns a chached struct containing author information name and email of that commit.
- #batch_data ⇒ Object
-
#data ⇒ Object
return the commits aggregated data in case a single commit is transferred.
-
#get_author ⇒ Object
returns the author struct fr the first time.
-
#initialize(commit = nil, project_identifier = nil) ⇒ Commit
constructor
A new instance of Commit.
-
#message ⇒ Object
returns the commit message of self.
-
#sha ⇒ Object
returns the commit hash of self.
-
#short_sha ⇒ Object
returns the short version of the commit hash of self.
-
#stats ⇒ Object
returns commits stats in more detail.
-
#time ⇒ Object
returns the time when self was committed.
-
#to_json ⇒ Object
return the commits aggregated data as JSON.
Constructor Details
Instance Attribute Details
#commit ⇒ Object
Returns the value of attribute commit.
5 6 7 |
# File 'lib/commit.rb', line 5 def commit @commit end |
#project_identifier ⇒ Object
Returns the value of attribute project_identifier.
5 6 7 |
# File 'lib/commit.rb', line 5 def project_identifier @project_identifier end |
Instance Method Details
#author ⇒ Object
returns a chached struct containing author information name and email of that commit
34 35 36 |
# File 'lib/commit.rb', line 34 def @author ||= end |
#batch_data ⇒ Object
58 59 60 |
# File 'lib/commit.rb', line 58 def batch_data @data ||= aggregate(:batch) end |
#data ⇒ Object
return the commits aggregated data in case a single commit is transferred
54 55 56 |
# File 'lib/commit.rb', line 54 def data @data ||= aggregate(:single) end |
#get_author ⇒ Object
returns the author struct fr the first time
39 40 41 42 43 44 |
# File 'lib/commit.rb', line 39 def = OpenStruct.new .name = .name .email = .email end |
#message ⇒ Object
returns the commit message of self
24 25 26 |
# File 'lib/commit.rb', line 24 def @commit. end |
#sha ⇒ Object
returns the commit hash of self
14 15 16 |
# File 'lib/commit.rb', line 14 def sha @commit.sha end |
#short_sha ⇒ Object
returns the short version of the commit hash of self
19 20 21 |
# File 'lib/commit.rb', line 19 def short_sha self.sha[0..6] end |
#stats ⇒ Object
returns commits stats in more detail
47 48 49 50 51 |
# File 'lib/commit.rb', line 47 def stats @commit.parent.diff(@commit).stats[:total] rescue nil end |
#time ⇒ Object
returns the time when self was committed
29 30 31 |
# File 'lib/commit.rb', line 29 def time Time.parse(.date.to_s) end |
#to_json ⇒ Object
return the commits aggregated data as JSON
63 64 65 |
# File 'lib/commit.rb', line 63 def to_json data.to_json end |