Class: DtkCommon::GitRepo::Adapter::Rugged::Tree

Inherits:
Obj
  • Object
show all
Defined in:
lib/git_repo/adapters/rugged/tree.rb

Instance Method Summary collapse

Constructor Details

#initialize(repo_branch, rugged_tree) ⇒ Tree

Returns a new instance of Tree.



21
22
23
24
# File 'lib/git_repo/adapters/rugged/tree.rb', line 21

def initialize(repo_branch,rugged_tree)
  super(repo_branch)
  @rugged_tree = rugged_tree
end

Instance Method Details

#get_file_content(path) ⇒ Object



26
27
28
29
30
# File 'lib/git_repo/adapters/rugged/tree.rb', line 26

def get_file_content(path)
  if blob = get_blob(path)
    blob.content
  end
end

#list_filesObject



32
33
34
35
36
37
38
# File 'lib/git_repo/adapters/rugged/tree.rb', line 32

def list_files()
  ret = Array.new
  @rugged_tree.walk_blobs do |root,entry|
    ret << "#{root}#{entry[:name]}"
  end
  ret
end