Class: Grit::GitRuby::Tag
- Defined in:
- lib/grit/git-ruby/git_object.rb
Instance Attribute Summary collapse
-
#message ⇒ Object
Returns the value of attribute message.
-
#object ⇒ Object
Returns the value of attribute object.
-
#object_type ⇒ Object
Returns the value of attribute object_type.
-
#tag ⇒ Object
Returns the value of attribute tag.
-
#tagger ⇒ Object
Returns the value of attribute tagger.
- #type ⇒ Object
Attributes inherited from GitObject
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(object, type, tag, tagger, message, repository = nil) ⇒ Tag
constructor
A new instance of Tag.
- #raw_content ⇒ Object
Methods inherited from GitObject
Constructor Details
#initialize(object, type, tag, tagger, message, repository = nil) ⇒ Tag
Returns a new instance of Tag.
332 333 334 335 336 337 338 339 340 |
# File 'lib/grit/git-ruby/git_object.rb', line 332 def initialize(object, type, tag, tagger, , repository=nil) @object = object @type = type @object_type = type @tag = tag @tagger = tagger @repository = repository @message = end |
Instance Attribute Details
#message ⇒ Object
Returns the value of attribute message.
294 295 296 |
# File 'lib/grit/git-ruby/git_object.rb', line 294 def @message end |
#object ⇒ Object
Returns the value of attribute object.
294 295 296 |
# File 'lib/grit/git-ruby/git_object.rb', line 294 def object @object end |
#object_type ⇒ Object
Returns the value of attribute object_type.
294 295 296 |
# File 'lib/grit/git-ruby/git_object.rb', line 294 def object_type @object_type end |
#tag ⇒ Object
Returns the value of attribute tag.
294 295 296 |
# File 'lib/grit/git-ruby/git_object.rb', line 294 def tag @tag end |
#tagger ⇒ Object
Returns the value of attribute tagger.
294 295 296 |
# File 'lib/grit/git-ruby/git_object.rb', line 294 def tagger @tagger end |
#type ⇒ Object
347 348 349 |
# File 'lib/grit/git-ruby/git_object.rb', line 347 def type :tag end |
Class Method Details
.from_raw(rawobject, repository = nil) ⇒ Object
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
# File 'lib/grit/git-ruby/git_object.rb', line 297 def self.from_raw(rawobject, repository=nil) headers, = rawobject.content.split(/\n\n/, 2) headers = headers.split(/\n/).map { |header| header.split(' ', 2) } object = '' type = '' tag = '' tagger = '' headers.each do |key, value| case key when "object" object = value when "type" if !["blob", "tree", "commit", "tag"].include?(value) raise RuntimeError, "invalid type in tag" end type = value.to_sym when "tag" tag = value when "tagger" tagger = UserInfo.new(value) else warn "unknown header '%s' in tag" % \ [key, rawobject.sha1.unpack("H*")[0]] end end if not object && type && tag && tagger raise RuntimeError, "incomplete raw tag object" end new(object, type, tag, tagger, , repository) end |
Instance Method Details
#raw_content ⇒ Object
342 343 344 345 |
# File 'lib/grit/git-ruby/git_object.rb', line 342 def raw_content ("object %s\ntype %s\ntag %s\ntagger %s\n\n" % \ [@object, @type, @tag, @tagger]) + @message.to_s end |