Sha256: ed98017903455128f0adfb6443f9d586a2d74621fd28afc98c4718b40f947023
Contents?: true
Size: 582 Bytes
Versions: 3
Compression:
Stored size: 582 Bytes
Contents
module Gitrb 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gitrb-0.2.4 | lib/gitrb/gitobject.rb |
gitrb-0.2.3 | lib/gitrb/gitobject.rb |
gitrb-0.2.2 | lib/gitrb/gitobject.rb |