Sha256: fb669af0989daacd865aafb64108c9440678d2f026d9bf5ae38e0aaa813456fc

Contents?: true

Size: 702 Bytes

Versions: 3

Compression:

Stored size: 702 Bytes

Contents

module Gitrb

  class Tag < Gitrb::Object
    attr_accessor :object, :tagtype, :tagger, :message

    def initialize(options = {})
      super(options)
      parse(options[:data]) if options[:data]
    end

    def ==(other)
      Tag === other and id == other.id
    end

    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'
          @tagtype = value
        when 'object'
          @object = Reference.new(:repository => repository, :id => value)
        when 'tagger'
          @tagger = User.parse(value)
        end
      end

      self
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gitrb-0.0.3 lib/gitrb/tag.rb
gitrb-0.0.2 lib/gitrb/tag.rb
gitrb-0.0.1 lib/gitrb/tag.rb