Class: Git::DetachedHeadInfo
- Inherits:
-
Data
- Object
- Data
- Git::DetachedHeadInfo
- Defined in:
- lib/git/detached_head_info.rb
Overview
Value object representing a detached HEAD state
When HEAD points directly to a commit rather than a branch reference, the repository is in a "detached HEAD" state. This object captures that state along with the commit SHA that HEAD points to.
This class shares a minimal interface with BranchInfo to allow polymorphic usage where appropriate:
short_name- returns 'HEAD'target_oid- returns the commit SHAto_s- returns 'HEAD'detached?- returns true
Instance Attribute Summary collapse
-
#target_oid ⇒ Object
readonly
Returns the value of attribute target_oid.
Instance Method Summary collapse
-
#detached? ⇒ Boolean
Always true for DetachedHeadInfo.
-
#short_name ⇒ String
Always 'HEAD'.
-
#to_s ⇒ String
Always 'HEAD'.
-
#unborn? ⇒ Boolean
Always false for DetachedHeadInfo (detached HEAD always has a commit).
Instance Attribute Details
#target_oid ⇒ Object (readonly)
Returns the value of attribute target_oid
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/git/detached_head_info.rb', line 41 DetachedHeadInfo = Data.define(:target_oid) do # @return [Boolean] always true for DetachedHeadInfo def detached? = true # @return [Boolean] always false for DetachedHeadInfo (detached HEAD always has a commit) def unborn? = false # @return [String] always 'HEAD' def short_name = 'HEAD' # @return [String] always 'HEAD' def to_s = 'HEAD' end |
Instance Method Details
#detached? ⇒ Boolean
Returns always true for DetachedHeadInfo.
43 |
# File 'lib/git/detached_head_info.rb', line 43 def detached? = true |
#short_name ⇒ String
Returns always 'HEAD'.
49 |
# File 'lib/git/detached_head_info.rb', line 49 def short_name = 'HEAD' |
#to_s ⇒ String
Returns always 'HEAD'.
52 |
# File 'lib/git/detached_head_info.rb', line 52 def to_s = 'HEAD' |
#unborn? ⇒ Boolean
Returns always false for DetachedHeadInfo (detached HEAD always has a commit).
46 |
# File 'lib/git/detached_head_info.rb', line 46 def unborn? = false |