Class: SimpleGit::Oid

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_git/oid.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOid

Returns a new instance of Oid.



5
6
7
# File 'lib/simple_git/oid.rb', line 5

def initialize
  @ptr = Git2::GitOid.new
end

Instance Attribute Details

#ptrObject

Returns the value of attribute ptr.



3
4
5
# File 'lib/simple_git/oid.rb', line 3

def ptr
  @ptr
end

Instance Method Details

#[](*args) ⇒ Object



15
16
17
# File 'lib/simple_git/oid.rb', line 15

def [](*args)
  to_s.[](*args)
end

#to_sObject



9
10
11
12
13
# File 'lib/simple_git/oid.rb', line 9

def to_s
  string = FFI::MemoryPointer.new(:char, 41)
  Git2.git_oid_tostr(string, 41, @ptr)
  string.read_string
end