Class: Grit::GitRuby::Tag
- Defined in:
- lib/grit/git-ruby/object.rb,
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.
-
#tag ⇒ Object
Returns the value of attribute tag.
-
#tagger ⇒ Object
Returns the value of attribute tagger.
-
#type ⇒ Object
Returns the value of attribute type.
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.
306 307 308 309 310 311 312 |
# File 'lib/grit/git-ruby/object.rb', line 306 def initialize(object, type, tag, tagger, repository=nil) @object = object @type = type @tag = tag @tagger = tagger @repository = repository end |
Instance Attribute Details
#message ⇒ Object
Returns the value of attribute message.
277 278 279 |
# File 'lib/grit/git-ruby/object.rb', line 277 def @message end |
#object ⇒ Object
Returns the value of attribute object.
277 278 279 |
# File 'lib/grit/git-ruby/object.rb', line 277 def object @object end |
#tag ⇒ Object
Returns the value of attribute tag.
277 278 279 |
# File 'lib/grit/git-ruby/object.rb', line 277 def tag @tag end |
#tagger ⇒ Object
Returns the value of attribute tagger.
277 278 279 |
# File 'lib/grit/git-ruby/object.rb', line 277 def tagger @tagger end |
#type ⇒ Object
Returns the value of attribute type.
277 278 279 |
# File 'lib/grit/git-ruby/object.rb', line 277 def type @type end |
Class Method Details
.from_raw(rawobject, repository = nil) ⇒ Object
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
# File 'lib/grit/git-ruby/object.rb', line 279 def self.from_raw(rawobject, repository=nil) headers, = rawobject.content.split(/\n\n/, 2) headers = headers.split(/\n/).map { |header| header.split(/ /, 2) } 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 if not object && type && tag && tagger raise RuntimeError, "incomplete raw tag object" end end new(object, type, tag, tagger, repository) end |
Instance Method Details
#raw_content ⇒ Object
314 315 316 317 |
# File 'lib/grit/git-ruby/object.rb', line 314 def raw_content "object %s\ntype %s\ntag %s\ntagger %s\n\n" % \ [@object, @type, @tag, @tagger] + @message end |