Class: GitCompound::Component::Version::Branch

Inherits:
VersionStrategy show all
Defined in:
lib/git_compound/component/version/branch.rb

Overview

Component version indicated by branch (head of branch)

Instance Method Summary collapse

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

Returns:

  • (Boolean)


20
21
22
# File 'lib/git_compound/component/version/branch.rb', line 20

def reachable?
  @repository.branches.key?(@branch)
end

#refObject



12
13
14
# File 'lib/git_compound/component/version/branch.rb', line 12

def ref
  @branch
end

#shaObject



16
17
18
# File 'lib/git_compound/component/version/branch.rb', line 16

def sha
  @repository.branches[@branch]
end

#to_sObject



24
25
26
# File 'lib/git_compound/component/version/branch.rb', line 24

def to_s
  "branch: #{@branch}"
end