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.
TODO: Annotated tags are not objects
Instance Attribute Summary collapse
-
#name
Returns the value of attribute name.
Attributes inherited from AbstractObject
#mode, #objectish, #size, #type
Instance Method Summary collapse
- #annotated? ⇒ Boolean
-
#initialize(base, sha, name = nil) ⇒ Tag
constructor
A new instance of Tag.
- #message
- #tag? ⇒ Boolean
- #tagger
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.
326 327 328 329 330 331 332 333 334 335 336 337 338 339 |
# File 'lib/git/object.rb', line 326 def initialize(base, sha, name = nil) if name.nil? name = sha repo = base.is_a?(Git::Base) ? base.facade_repository : base sha = repo.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
Returns the value of attribute name.
315 316 317 |
# File 'lib/git/object.rb', line 315 def name @name end |
Instance Method Details
#annotated? ⇒ Boolean
341 342 343 |
# File 'lib/git/object.rb', line 341 def annotated? @annotated = @annotated.nil? ? (object_repository.cat_file_type(name) == 'tag') : @annotated end |
#message
345 346 347 348 |
# File 'lib/git/object.rb', line 345 def check_tag @message end |
#tag? ⇒ Boolean
350 351 352 |
# File 'lib/git/object.rb', line 350 def tag? true end |
#tagger
354 355 356 357 |
# File 'lib/git/object.rb', line 354 def tagger check_tag @tagger end |