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.



99
100
101
102
103
104
# File 'lib/git/object.rb', line 99

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

Instance Method Details

#blobs Also known as: files



110
111
112
# File 'lib/git/object.rb', line 110

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

#children



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

def children
  blobs.merge(subtrees)
end

#depth



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

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

#full_tree



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

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

#tree?Boolean

Returns:

  • (Boolean)


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

def tree?
  true
end

#trees Also known as: subtrees, subdirectories



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

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