Class: Git::Object::Tree
- Inherits:
-
AbstractObject
- Object
- AbstractObject
- Git::Object::Tree
- Defined in:
- lib/git/object.rb
Overview
A Git tree object
Instance Attribute Summary
Attributes inherited from AbstractObject
#mode, #objectish, #size, #type
Instance Method Summary collapse
-
#blobs ⇒ Hash<String, Git::Object::Blob>
(also: #files)
Returns blobs directly under this tree.
-
#children ⇒ Hash<String, Git::Object::AbstractObject>
Returns child blobs and subtrees keyed by name.
-
#depth ⇒ Integer
Returns the maximum depth of this tree.
-
#full_tree ⇒ Hash
Returns the full tree listing for this tree.
-
#initialize(base, sha, mode = nil) ⇒ Tree
constructor
Creates a tree object wrapper.
-
#tree? ⇒ Boolean
Returns whether this object is a tree.
-
#trees ⇒ Hash<String, Git::Object::Tree>
(also: #subtrees, #subdirectories)
Returns subtrees directly under this tree.
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
Creates a tree object wrapper
302 303 304 305 306 307 |
# File 'lib/git/object.rb', line 302 def initialize(base, sha, mode = nil) super(base, sha) @mode = mode @trees = nil @blobs = nil end |
Instance Method Details
#blobs ⇒ Hash<String, Git::Object::Blob> Also known as: files
Returns blobs directly under this tree
321 322 323 |
# File 'lib/git/object.rb', line 321 def blobs @blobs ||= check_tree[:blobs] end |
#children ⇒ Hash<String, Git::Object::AbstractObject>
Returns child blobs and subtrees keyed by name
313 314 315 |
# File 'lib/git/object.rb', line 313 def children blobs.merge(subtrees) end |
#depth ⇒ Integer
Returns the maximum depth of this tree
348 349 350 |
# File 'lib/git/object.rb', line 348 def depth object_repository.tree_depth(@objectish) end |
#full_tree ⇒ Hash
Returns the full tree listing for this tree
340 341 342 |
# File 'lib/git/object.rb', line 340 def full_tree object_repository.full_tree(@objectish) end |
#tree? ⇒ Boolean
Returns whether this object is a tree
356 357 358 |
# File 'lib/git/object.rb', line 356 def tree? true end |
#trees ⇒ Hash<String, Git::Object::Tree> Also known as: subtrees, subdirectories
Returns subtrees directly under this tree
330 331 332 |
# File 'lib/git/object.rb', line 330 def trees @trees ||= check_tree[:trees] end |