Class: Dandelion::Tree
- Inherits:
-
Object
- Object
- Dandelion::Tree
- Defined in:
- lib/dandelion/tree.rb
Instance Attribute Summary collapse
-
#commit ⇒ Object
readonly
Returns the value of attribute commit.
Instance Method Summary collapse
- #data(path) ⇒ Object
-
#initialize(repo, commit) ⇒ Tree
constructor
A new instance of Tree.
Constructor Details
#initialize(repo, commit) ⇒ Tree
Returns a new instance of Tree.
5 6 7 8 |
# File 'lib/dandelion/tree.rb', line 5 def initialize(repo, commit) @repo = repo @commit = commit end |
Instance Attribute Details
#commit ⇒ Object (readonly)
Returns the value of attribute commit.
3 4 5 |
# File 'lib/dandelion/tree.rb', line 3 def commit @commit end |
Instance Method Details
#data(path) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/dandelion/tree.rb', line 10 def data(path) object = @commit.tree info = {} path.split('/').each do |name| info = object[name] return nil unless info return nil unless info[:type] object = @repo.lookup(info[:oid]) return nil unless object end content(info, object) end |