Class: GitStore::Tag
- Inherits:
-
Object
- Object
- GitStore::Tag
- Defined in:
- lib/git_store/tag.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#message ⇒ Object
Returns the value of attribute message.
-
#object ⇒ Object
Returns the value of attribute object.
-
#store ⇒ Object
Returns the value of attribute store.
-
#tagger ⇒ Object
Returns the value of attribute tagger.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(store, id = nil, data = nil) ⇒ Tag
constructor
A new instance of Tag.
- #parse(data) ⇒ Object
Constructor Details
#initialize(store, id = nil, data = nil) ⇒ Tag
Returns a new instance of Tag.
6 7 8 9 10 11 |
# File 'lib/git_store/tag.rb', line 6 def initialize(store, id = nil, data = nil) @store = store @id = id parse(data) if data end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/git_store/tag.rb', line 4 def id @id end |
#message ⇒ Object
Returns the value of attribute message.
4 5 6 |
# File 'lib/git_store/tag.rb', line 4 def @message end |
#object ⇒ Object
Returns the value of attribute object.
4 5 6 |
# File 'lib/git_store/tag.rb', line 4 def object @object end |
#store ⇒ Object
Returns the value of attribute store.
4 5 6 |
# File 'lib/git_store/tag.rb', line 4 def store @store end |
#tagger ⇒ Object
Returns the value of attribute tagger.
4 5 6 |
# File 'lib/git_store/tag.rb', line 4 def tagger @tagger end |
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/git_store/tag.rb', line 4 def type @type end |
Instance Method Details
#==(other) ⇒ Object
13 14 15 |
# File 'lib/git_store/tag.rb', line 13 def ==(other) Tag === other and id == other.id end |
#parse(data) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/git_store/tag.rb', line 17 def parse(data) headers, @message = data.split(/\n\n/, 2) headers.split(/\n/).each do |header| key, value = header.split(/ /, 2) case key when 'type' @type = value when 'object' @object = store.get(value) when 'tagger' @tagger = User.parse(value) end end self end |