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.



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

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

Instance Method Details

#blobsObject Also known as: files



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

def blobs
  @blobs ||= check_tree[:blobs]
end

#childrenObject



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

def children
  blobs.merge(subtrees)
end

#depthObject



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

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

#full_treeObject



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

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

#tree?Boolean

Returns:

  • (Boolean)


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

def tree?
  true
end

#treesObject Also known as: subtrees, subdirectories



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

def trees
  @trees ||= check_tree[:trees]
end