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.

[View source]

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

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

Instance Method Details

#blobs Also known as: files

[View source]

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

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

#children

[View source]

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

def children
  blobs.merge(subtrees)
end

#depth

[View source]

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

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

#full_tree

[View source]

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

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

#tree?Boolean

Returns:

  • (Boolean)
[View source]

131
132
133
# File 'lib/git/object.rb', line 131

def tree?
  true
end

#trees Also known as: subtrees, subdirectories

[View source]

117
118
119
# File 'lib/git/object.rb', line 117

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