class VCLog::Tag
Attributes
Last commit before Tag
.
Date tag was made.
@todo Hg is using this at the moment but it really shouldn’t be here,
since it is take care of by `commit.files`.
Tag’s commit id.
Tag
name, which in this case is typically a version stamp.
Tag
message.
Tag
message.
Tag
name, which in this case is typically a version stamp.
Tag
name, which in this case is typically a version stamp.
Creator to the tag.
Creator to the tag.
Public Class Methods
Setup new Tag
intsance.
If ‘:commit` is not provided, it is assume that the underlying SCM simply creates tags as references to a commit. That is to say the tag information and the commit information are one and the same. This is the case for Hg, but not for Git, for instance.
# File lib/vclog/tag.rb, line 50 def initialize(data={}) @commit = data.delete(:commit) || Change.new(data) data.each do |k,v| __send__("#{k}=", v) end end
Public Instance Methods
Normal tag order is the reverse typical sorts.
# File lib/vclog/tag.rb, line 130 def <=>(other) return -1 if name == 'HEAD' other.name <=> name end
Set the tag date, converting date
to a Time object.
# File lib/vclog/tag.rb, line 89 def date=(date) @date = parse_date(date) end
Inspection string for Tag
.
# File lib/vclog/tag.rb, line 122 def inspect dstr = date ? date.strftime('%Y-%m-%d %H:%M:%S') : '(date?)' "<Tag #{name} #{dstr}>" end
Set the tag message.
# File lib/vclog/tag.rb, line 96 def message=(msg) @message = msg.strip end
Set the tag name.
# File lib/vclog/tag.rb, line 61 def name=(name) @name = (name || 'HEAD').strip end
Convert to Hash.
# File lib/vclog/tag.rb, line 109 def to_h { 'name' => name, 'date' => date, 'author' => author, 'message' => message, 'commit' => commit.to_h } end
Private Instance Methods
# File lib/vclog/tag.rb, line 140 def parse_date(date) case date when Time date else Time.parse(date.to_s) end end