Class: GitCompound::Component::Version::Branch
- Inherits:
-
VersionStrategy
- Object
- VersionStrategy
- GitCompound::Component::Version::Branch
- Defined in:
- lib/git_compound/component/version/branch.rb
Overview
Component version indicated by branch (head of branch)
Instance Method Summary collapse
-
#initialize(repository, branch) ⇒ Branch
constructor
A new instance of Branch.
- #reachable? ⇒ Boolean
- #ref ⇒ Object
- #sha ⇒ Object
- #to_s ⇒ Object
Methods inherited from VersionStrategy
Constructor Details
#initialize(repository, branch) ⇒ Branch
Returns a new instance of Branch.
7 8 9 10 |
# File 'lib/git_compound/component/version/branch.rb', line 7 def initialize(repository, branch) @repository = repository @branch = branch end |
Instance Method Details
#reachable? ⇒ Boolean
20 21 22 |
# File 'lib/git_compound/component/version/branch.rb', line 20 def reachable? @repository.branches.key?(@branch) end |
#ref ⇒ Object
12 13 14 |
# File 'lib/git_compound/component/version/branch.rb', line 12 def ref @branch end |
#sha ⇒ Object
16 17 18 |
# File 'lib/git_compound/component/version/branch.rb', line 16 def sha @repository.branches[@branch] end |
#to_s ⇒ Object
24 25 26 |
# File 'lib/git_compound/component/version/branch.rb', line 24 def to_s "branch: #{@branch}" end |