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.



4
5
6
7
# File 'lib/git_repo/adapters/rugged/tree.rb', line 4

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

Instance Method Details

#get_file_content(path) ⇒ Object



9
10
11
12
13
# File 'lib/git_repo/adapters/rugged/tree.rb', line 9

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

#list_filesObject



15
16
17
18
19
20
21
# File 'lib/git_repo/adapters/rugged/tree.rb', line 15

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