Class: Zubat::Commit
- Inherits:
-
Object
- Object
- Zubat::Commit
- Defined in:
- lib/zubat/commit.rb
Instance Attribute Summary collapse
-
#sha ⇒ Object
readonly
Returns the value of attribute sha.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Class Method Summary collapse
Instance Method Summary collapse
- #diff(file:) ⇒ Object
- #exists?(file:) ⇒ Boolean
-
#initialize(sha:, time:) ⇒ Commit
constructor
A new instance of Commit.
- #show(file:) ⇒ Object
Constructor Details
#initialize(sha:, time:) ⇒ Commit
Returns a new instance of Commit.
17 18 19 20 |
# File 'lib/zubat/commit.rb', line 17 def initialize(sha:, time:) @sha = sha @time = time end |
Instance Attribute Details
#sha ⇒ Object (readonly)
Returns the value of attribute sha.
5 6 7 |
# File 'lib/zubat/commit.rb', line 5 def sha @sha end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
5 6 7 |
# File 'lib/zubat/commit.rb', line 5 def time @time end |
Class Method Details
.find(files:) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/zubat/commit.rb', line 7 def self.find(files:) logs = GitCommandWrapper.new.log(files:) commits = logs.map { |log| Zubat::Commit.new(sha: log.sha, time: log.time) } commits.reverse! commits end |
Instance Method Details
#diff(file:) ⇒ Object
30 31 32 |
# File 'lib/zubat/commit.rb', line 30 def diff(file:) GitCommandWrapper.new.diff(sha: @sha, file:) end |
#exists?(file:) ⇒ Boolean
22 23 24 |
# File 'lib/zubat/commit.rb', line 22 def exists?(file:) GitCommandWrapper.new.exists?(sha: @sha, file:) end |
#show(file:) ⇒ Object
26 27 28 |
# File 'lib/zubat/commit.rb', line 26 def show(file:) GitCommandWrapper.new.show(sha: @sha, file:) end |