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
299 300 301 302 303 304 |
# File 'lib/git/object.rb', line 299 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
318 319 320 |
# File 'lib/git/object.rb', line 318 def blobs @blobs ||= check_tree[:blobs] end |
#children ⇒ Hash<String, Git::Object::AbstractObject>
Returns child blobs and subtrees keyed by name
310 311 312 |
# File 'lib/git/object.rb', line 310 def children blobs.merge(subtrees) end |
#depth ⇒ Integer
Returns the maximum depth of this tree
345 346 347 |
# File 'lib/git/object.rb', line 345 def depth object_repository.tree_depth(@objectish) end |
#full_tree ⇒ Hash
Returns the full tree listing for this tree
337 338 339 |
# File 'lib/git/object.rb', line 337 def full_tree object_repository.full_tree(@objectish) end |
#tree? ⇒ Boolean
Returns whether this object is a tree
353 354 355 |
# File 'lib/git/object.rb', line 353 def tree? true end |
#trees ⇒ Hash<String, Git::Object::Tree> Also known as: subtrees, subdirectories
Returns subtrees directly under this tree
327 328 329 |
# File 'lib/git/object.rb', line 327 def trees @trees ||= check_tree[:trees] end |