Class: SimpleGit::Repository
- Inherits:
-
Object
- Object
- SimpleGit::Repository
- Defined in:
- lib/simple_git/repository.rb
Defined Under Namespace
Classes: RepositoryWrapper
Instance Attribute Summary collapse
-
#ptr ⇒ Object
Returns the value of attribute ptr.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path) ⇒ Repository
constructor
A new instance of Repository.
- #revparse(refspec) ⇒ Object
Constructor Details
#initialize(path) ⇒ Repository
Returns a new instance of Repository.
5 6 7 8 9 10 11 12 |
# File 'lib/simple_git/repository.rb', line 5 def initialize(path) wrapper = RepositoryWrapper.new Git2.git_repository_open(wrapper, path) @ptr = wrapper[:repo] ObjectSpace.define_finalizer(self, self.class.finalize(@ptr)) end |
Instance Attribute Details
#ptr ⇒ Object
Returns the value of attribute ptr.
3 4 5 |
# File 'lib/simple_git/repository.rb', line 3 def ptr @ptr end |
Class Method Details
.finalize(ptr) ⇒ Object
23 24 25 |
# File 'lib/simple_git/repository.rb', line 23 def self.finalize(ptr) proc { Git2.git_repository_free(ptr) } end |
Instance Method Details
#revparse(refspec) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/simple_git/repository.rb', line 14 def revparse(refspec) wrapper = SimpleGit::Object::ObjectWrapper.new Git2.git_revparse_single(wrapper, @ptr, refspec) Object.new.from_wrapper(wrapper) end |