class Graal::Tree

Public Instance Methods

/(child_path)
Alias for: child
[](child_path)
Alias for: child
blobs(&block) click to toggle source
# File lib/graal/tree.rb, line 30
def blobs(&block)
   enum_children(:blobs, 'blob', &block)
end
Also aliased as: each_blob, list_blobs
child(child_path) click to toggle source
# File lib/graal/tree.rb, line 7
def child(child_path)
   fullpath = File.join(@path, child_path)
   fullpath[ 0] = '' if fullpath[ 0] == ?/
   fullpath[-1] = '' if fullpath[-1] == ?/
   type, child_gitid = @backend.child(gitid, fullpath)
   child_for(type, fullpath, child_gitid)
end
Also aliased as: [], /
children(&block) click to toggle source
# File lib/graal/tree.rb, line 17
def children(&block)
   enum_children(:children, &block)
end
Also aliased as: each_child, list, ls
each_blob(&block)
Alias for: blobs
each_child(&block)
Alias for: children
each_tree(&block)
Alias for: trees
list(&block)
Alias for: children
list_blobs(&block)
Alias for: blobs
list_trees(&block)
Alias for: trees
ls(&block)
Alias for: children
trees(&block) click to toggle source
# File lib/graal/tree.rb, line 24
def trees(&block)
   enum_children(:trees, 'tree', &block)
end
Also aliased as: each_tree, list_trees

Private Instance Methods

child_for(type, fullpath, gitid) click to toggle source
# File lib/graal/tree.rb, line 46
def child_for(type, fullpath, gitid)
   return Blob.new(@backend, @revision, fullpath, gitid) if type == 'blob'
   Tree.new(@backend, @revision, fullpath, gitid)
end
enum_children(method, filter = nil) { |child_for(*data)| ... } click to toggle source
# File lib/graal/tree.rb, line 38
def enum_children(method, filter = nil)
   dirpath = @path.empty? ? path : path + '/'
   @backend.children(gitid, dirpath, filter).each do |data|
      yield child_for(*data)
   end if block_given?
   Enumerator.new(self, method)
end