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.
268 269 270 271 272 273 274 275 276 277 278 279 280 |
# File 'lib/git/object.rb', line 268 def initialize(base, sha, name = nil) if name.nil? name = sha sha = base.lib.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.
257 258 259 |
# File 'lib/git/object.rb', line 257 def name @name end |
Instance Method Details
#annotated? ⇒ Boolean
282 283 284 |
# File 'lib/git/object.rb', line 282 def annotated? @annotated = @annotated.nil? ? (@base.lib.cat_file_type(name) == 'tag') : @annotated end |
#message
286 287 288 289 |
# File 'lib/git/object.rb', line 286 def check_tag @message end |
#tag? ⇒ Boolean
291 292 293 |
# File 'lib/git/object.rb', line 291 def tag? true end |
#tagger
295 296 297 298 |
# File 'lib/git/object.rb', line 295 def tagger check_tag @tagger end |