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::Author?
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.
554 555 556 557 558 559 560 561 562 563 564 565 566 |
# File 'lib/git/object.rb', line 554 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.
538 539 540 |
# File 'lib/git/object.rb', line 538 def name @name end |
Instance Method Details
#annotated? ⇒ Boolean
Returns whether this tag is annotated
572 573 574 |
# File 'lib/git/object.rb', line 572 def annotated? @annotated = @annotated.nil? ? (object_repository.cat_file_type(name) == 'tag') : @annotated end |
#message ⇒ String?
Returns the tag message
581 582 583 584 |
# File 'lib/git/object.rb', line 581 def check_tag @message end |
#tag? ⇒ Boolean
Returns whether this object is a tag
590 591 592 |
# File 'lib/git/object.rb', line 590 def tag? true end |
#tagger ⇒ Git::Author?
Returns the tagger identity
599 600 601 602 |
# File 'lib/git/object.rb', line 599 def tagger check_tag @tagger end |