Class: Awsborn::GitBranch
- Inherits:
-
Object
- Object
- Awsborn::GitBranch
- Defined in:
- lib/awsborn/git_branch.rb
Instance Attribute Summary collapse
-
#branch ⇒ Object
readonly
Returns the value of attribute branch.
Instance Method Summary collapse
- #file(path) ⇒ Object
-
#initialize(branch) ⇒ GitBranch
constructor
A new instance of GitBranch.
Constructor Details
#initialize(branch) ⇒ GitBranch
Returns a new instance of GitBranch.
6 7 8 9 |
# File 'lib/awsborn/git_branch.rb', line 6 def initialize (branch) require 'git' @branch = branch end |
Instance Attribute Details
#branch ⇒ Object (readonly)
Returns the value of attribute branch.
4 5 6 |
# File 'lib/awsborn/git_branch.rb', line 4 def branch @branch end |
Instance Method Details
#file(path) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/awsborn/git_branch.rb', line 11 def file (path) path, file = File.split(path) repo = Git.open(root) tree = repo.branches[branch].gcommit.gtree path.each { |dir| tree = tree.subtrees[dir] } tree.blobs[file].contents end |