Class: Dandelion::Tree
- Inherits:
-
Object
- Object
- Dandelion::Tree
- Defined in:
- lib/dandelion/tree.rb
Constant Summary collapse
- FILEMODE_BLOB =
0100644
- FILEMODE_BLOB_EXECUTABLE =
0100755
- FILEMODE_SYMLINK =
0120000
Instance Attribute Summary collapse
-
#commit ⇒ Object
readonly
Returns the value of attribute commit.
Instance Method Summary collapse
- #blob?(path) ⇒ Boolean
- #data(path) ⇒ Object
-
#initialize(repo, commit) ⇒ Tree
constructor
A new instance of Tree.
- #symlink?(path) ⇒ Boolean
Constructor Details
#initialize(repo, commit) ⇒ Tree
Returns a new instance of Tree.
10 11 12 13 |
# File 'lib/dandelion/tree.rb', line 10 def initialize(repo, commit) @repo = repo @commit = commit end |
Instance Attribute Details
#commit ⇒ Object (readonly)
Returns the value of attribute commit.
8 9 10 |
# File 'lib/dandelion/tree.rb', line 8 def commit @commit end |
Instance Method Details
#blob?(path) ⇒ Boolean
19 20 21 22 |
# File 'lib/dandelion/tree.rb', line 19 def blob?(path) mode = filemode(path) mode == FILEMODE_BLOB || mode == FILEMODE_BLOB_EXECUTABLE end |
#data(path) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/dandelion/tree.rb', line 24 def data(path) if blob?(path) || symlink?(path) obj = object(path) blob_content(obj) else # TODO nil end end |
#symlink?(path) ⇒ Boolean
15 16 17 |
# File 'lib/dandelion/tree.rb', line 15 def symlink?(path) filemode(path) == FILEMODE_SYMLINK end |