Class: Git::Object::Tag
- Inherits:
-
AbstractObject
- Object
- AbstractObject
- Git::Object::Tag
- Defined in:
- lib/git/object.rb
Overview
A Git tag object
This class represents a tag in Git, which can be either annotated or lightweight.
Annotated tags contain additional metadata such as the tagger's name, email, and the date when the tag was created, along with a message.
Instance Attribute Summary collapse
-
#name ⇒ String
The tag name.
Attributes inherited from AbstractObject
#mode, #objectish, #size, #type
Instance Method Summary collapse
-
#annotated? ⇒ Boolean
Returns whether this tag is annotated.
-
#initialize(base, sha, name = nil) ⇒ Tag
constructor
A new instance of Tag.
-
#message ⇒ String?
Returns the tag message.
-
#tag? ⇒ Boolean
Returns whether this object is a tag.
-
#tagger ⇒ Git::AuthorInfo?
Returns the tagger identity.
Methods inherited from AbstractObject
#archive, #blob?, #commit?, #contents, #contents_array, #diff, #grep, #log, #sha, #to_s, #tree?
Constructor Details
#initialize(base, name) ⇒ Tag #initialize(base, sha, name) ⇒ Tag
Returns a new instance of Tag.
560 561 562 563 564 565 566 567 568 569 570 571 572 |
# File 'lib/git/object.rb', line 560 def initialize(base, sha, name = nil) if name.nil? name = sha sha = base.tag_sha(name) raise Git::UnexpectedResultError, "Tag '#{name}' does not exist." if sha == '' end super(base, sha) @name = name @annotated = nil @loaded = false end |
Instance Attribute Details
#name ⇒ String
Returns the tag name.
544 545 546 |
# File 'lib/git/object.rb', line 544 def name @name end |
Instance Method Details
#annotated? ⇒ Boolean
Returns whether this tag is annotated
578 579 580 |
# File 'lib/git/object.rb', line 578 def annotated? @annotated = @annotated.nil? ? (object_repository.cat_file_type(name) == 'tag') : @annotated end |
#message ⇒ String?
Returns the tag message
587 588 589 590 |
# File 'lib/git/object.rb', line 587 def check_tag end |
#tag? ⇒ Boolean
Returns whether this object is a tag
596 597 598 |
# File 'lib/git/object.rb', line 596 def tag? true end |
#tagger ⇒ Git::AuthorInfo?
Returns the tagger identity
605 606 607 608 |
# File 'lib/git/object.rb', line 605 def tagger check_tag @tagger end |