Sha256: a79d1ce3d0ccf214bfed583fb323b9c8134aca6c495af292bb391cb93393c2f5
Contents?: true
Size: 630 Bytes
Versions: 4
Compression:
Stored size: 630 Bytes
Contents
module Gitrb # Base class for blob, tree, commit and tag class GitObject attr_accessor :repository, :id def initialize(options = {}) @repository = options[:repository] @id = options[:id] end def git_object self end def ==(other) self.class === other && id == other.id end @types = {} def self.inherited(subclass) @types[subclass.name[7..-1].downcase] = subclass end def self.factory(type, *args) klass = @types[type] raise NotImplementedError, "Object type not supported: #{type}" if !klass klass.new(*args) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
gitrb-0.2.8 | lib/gitrb/gitobject.rb |
gitrb-0.2.7 | lib/gitrb/gitobject.rb |
gitrb-0.2.6 | lib/gitrb/gitobject.rb |
gitrb-0.2.5 | lib/gitrb/gitobject.rb |