Class: TagList
- Inherits:
-
Object
- Object
- TagList
- Defined in:
- lib/tag_list.rb
Overview
Builds a list of tags in the current git repository. The tags are enclosed by the sha1 of the first commit and optionally “HEAD” to allow traversing the list with each_con to obtain start and end points of developmental epochs.
Instance Attribute Summary collapse
-
#list ⇒ Object
readonly
Returns an array of tag names surrounded by HEAD at the top and the sha1 of the first commit at the bottom.
Instance Method Summary collapse
-
#initialize(include_head = true) ⇒ TagList
constructor
Instantiates the tag list.
-
#latest_tag ⇒ String
Returns the most recent tag in the git repository, or the sha1 of the initial commit if there is no tag.
Constructor Details
#initialize(include_head = true) ⇒ TagList
Instantiates the tag list.
31 32 33 34 |
# File 'lib/tag_list.rb', line 31 def initialize(include_head = true) @include_head = include_head @list = build_list end |
Instance Attribute Details
#list ⇒ Object (readonly)
Returns an array of tag names surrounded by HEAD at the top and the sha1 of the first commit at the bottom.
24 25 26 |
# File 'lib/tag_list.rb', line 24 def list @list end |
Instance Method Details
#latest_tag ⇒ String
Returns the most recent tag in the git repository, or the sha1 of the initial commit if there is no tag.
41 42 43 44 45 |
# File 'lib/tag_list.rb', line 41 def latest_tag # Index 0 is HEAD # Index 1 is most recent tag or first commit @list[1] end |