Sha256: 2e817b4cbdb37c3dfb2f2e169acb46043ecae2ecc741f7c52e85535e4911799d

Contents?: true

Size: 740 Bytes

Versions: 2

Compression:

Stored size: 740 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 => repository.encode(value))
        when 'tagger'
          @tagger = User.parse(repository.encode(value))
        end
      end

      self
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gitrb-0.0.5 lib/gitrb/tag.rb
gitrb-0.0.4 lib/gitrb/tag.rb