Class: MethodLog::Repository
- Inherits:
-
Object
- Object
- MethodLog::Repository
- Defined in:
- lib/method_log/repository.rb
Instance Attribute Summary collapse
-
#commits ⇒ Object
readonly
Returns the value of attribute commits.
Instance Method Summary collapse
- #add(commit) ⇒ Object
- #build_commit(sha: nil) ⇒ Object
-
#initialize(path: nil) ⇒ Repository
constructor
A new instance of Repository.
Constructor Details
#initialize(path: nil) ⇒ Repository
Returns a new instance of Repository.
9 10 11 12 13 14 15 16 17 |
# File 'lib/method_log/repository.rb', line 9 def initialize(path: nil) @repository = Rugged::Repository.new(path) @commits = [] if @repository.ref('refs/heads/master') @repository.walk(@repository.last_commit) do |commit| @commits << build_commit(sha: commit.oid) end end end |
Instance Attribute Details
#commits ⇒ Object (readonly)
Returns the value of attribute commits.
7 8 9 |
# File 'lib/method_log/repository.rb', line 7 def commits @commits end |
Instance Method Details
#add(commit) ⇒ Object
23 24 25 26 |
# File 'lib/method_log/repository.rb', line 23 def add(commit) commit.apply @commits << commit end |