Class: Git::Object::Tree

Inherits:
AbstractObject show all
Defined in:
lib/git/object.rb

Instance Attribute Summary

Attributes inherited from AbstractObject

#mode, #objectish, #size, #type

Instance Method Summary collapse

Methods inherited from AbstractObject

#archive, #blob?, #commit?, #contents, #contents_array, #diff, #grep, #log, #sha, #tag?, #to_s

Constructor Details

#initialize(base, sha, mode = nil) ⇒ Tree

Returns a new instance of Tree.



98
99
100
101
# File 'lib/git/object.rb', line 98

def initialize(base, sha, mode = nil)
  super(base, sha)
  @mode = mode
end

Instance Method Details

#blobsObject Also known as: files



107
108
109
110
# File 'lib/git/object.rb', line 107

def blobs
  check_tree
  @blobs
end

#childrenObject



103
104
105
# File 'lib/git/object.rb', line 103

def children
  blobs.merge(subtrees)
end

#depthObject



124
125
126
# File 'lib/git/object.rb', line 124

def depth
  @base.lib.tree_depth(@objectish)
end

#full_treeObject



120
121
122
# File 'lib/git/object.rb', line 120

def full_tree
  @base.lib.full_tree(@objectish)
end

#tree?Boolean

Returns:

  • (Boolean)


128
129
130
# File 'lib/git/object.rb', line 128

def tree?
  true
end

#treesObject Also known as: subtrees, subdirectories



113
114
115
116
# File 'lib/git/object.rb', line 113

def trees
  check_tree
  @trees
end