Class: RightGit::Git::Tag
- Inherits:
-
Object
- Object
- RightGit::Git::Tag
- Includes:
- BelongsToRepository
- Defined in:
- lib/right_git/git/tag.rb
Overview
A tag in a Git repository.
Defined Under Namespace
Classes: TagError
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes included from BelongsToRepository
Instance Method Summary collapse
-
#<=>(other) ⇒ Integer
Comparison value.
-
#==(other) ⇒ TrueClass|FalseClass
True if equivalent.
-
#delete ⇒ TrueClass
Deletes this tag.
-
#initialize(repo, name) ⇒ Tag
constructor
A new instance of Tag.
-
#inspect ⇒ String
Info about this Ruby object.
-
#to_s ⇒ String
The tag’s name.
Methods included from BelongsToRepository
Constructor Details
#initialize(repo, name) ⇒ Tag
Returns a new instance of Tag.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/right_git/git/tag.rb', line 38 def initialize(repo, name) # TEAL FIX: only invalid characters seem to be whitespace and some file # system special characters; need to locate a definitive schema for tag # names. if name.index(/\s|[:\\?*<>\|]/) raise TagError, 'name is invalid' end @repo = repo @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
32 33 34 |
# File 'lib/right_git/git/tag.rb', line 32 def name @name end |
Instance Method Details
#<=>(other) ⇒ Integer
Returns comparison value.
71 72 73 74 75 76 77 |
# File 'lib/right_git/git/tag.rb', line 71 def <=>(other) if other.kind_of?(self.class) @name <=> other.name else raise ::ArgumentError, 'Wrong type' end end |
#==(other) ⇒ TrueClass|FalseClass
Returns true if equivalent.
61 62 63 64 65 66 67 |
# File 'lib/right_git/git/tag.rb', line 61 def ==(other) if other.kind_of?(self.class) @name == other.name else false end end |
#delete ⇒ TrueClass
Deletes this tag.
82 83 84 85 |
# File 'lib/right_git/git/tag.rb', line 82 def delete @repo.vet_output("tag -d #{@name}") true end |
#inspect ⇒ String
Returns info about this Ruby object.
55 56 57 |
# File 'lib/right_git/git/tag.rb', line 55 def inspect "#<#{self.class.name}:#{name.inspect}>" end |
#to_s ⇒ String
Returns the tag’s name.
50 51 52 |
# File 'lib/right_git/git/tag.rb', line 50 def to_s name end |