class RepoMiner::Commit
Attributes
data[RW]
repository[R]
rugged_commit[R]
Public Class Methods
new(repository, rugged_commit)
click to toggle source
# File lib/repo_miner/commit.rb, line 7 def initialize(repository, rugged_commit) @repository = repository @rugged_commit = rugged_commit @data = {} end
Public Instance Methods
add_data(key, miner_data)
click to toggle source
# File lib/repo_miner/commit.rb, line 36 def add_data(key, miner_data) data[key] = miner_data end
analyse()
click to toggle source
# File lib/repo_miner/commit.rb, line 29 def analyse Miners::Email.new.analyse(self) Miners::Dependencies.new.analyse(self) self end
content_after(file_path)
click to toggle source
# File lib/repo_miner/commit.rb, line 44 def content_after(file_path) content_for_commit(rugged_commit, file_path) end
content_before(file_path)
click to toggle source
# File lib/repo_miner/commit.rb, line 40 def content_before(file_path) content_for_commit(rugged_commit.parents[0], file_path) end
inspect()
click to toggle source
# File lib/repo_miner/commit.rb, line 48 def inspect "<RepoMiner::Commit:#{"0x00%x" % (object_id << 1)}(message: '#{message}', sha: '#{sha}', data: #{data})>" end
merge?()
click to toggle source
# File lib/repo_miner/commit.rb, line 25 def merge? rugged_commit.parents.length > 1 end
message()
click to toggle source
# File lib/repo_miner/commit.rb, line 13 def message rugged_commit.message.strip end
sha()
click to toggle source
# File lib/repo_miner/commit.rb, line 17 def sha rugged_commit.oid end
timestamp()
click to toggle source
# File lib/repo_miner/commit.rb, line 21 def timestamp rugged_commit.time end
Private Instance Methods
content_for_commit(rugged_commit, file_path)
click to toggle source
# File lib/repo_miner/commit.rb, line 54 def content_for_commit(rugged_commit, file_path) path = rugged_commit.tree.path(file_path) blob = repository.rugged_repository.lookup(path[:oid]) blob.content end