Class: Gitrb::GitObject
- Inherits:
-
Object
- Object
- Gitrb::GitObject
- Defined in:
- lib/gitrb/gitobject.rb
Overview
Base class for blob, tree, commit and tag
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#repository ⇒ Object
Returns the value of attribute repository.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #git_object ⇒ Object
-
#initialize(options = {}) ⇒ GitObject
constructor
A new instance of GitObject.
Constructor Details
#initialize(options = {}) ⇒ GitObject
Returns a new instance of GitObject.
7 8 9 10 |
# File 'lib/gitrb/gitobject.rb', line 7 def initialize( = {}) @repository = [:repository] @id = [:id] end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/gitrb/gitobject.rb', line 5 def id @id end |
#repository ⇒ Object
Returns the value of attribute repository.
5 6 7 |
# File 'lib/gitrb/gitobject.rb', line 5 def repository @repository end |
Class Method Details
.factory(type, *args) ⇒ Object
26 27 28 29 30 |
# File 'lib/gitrb/gitobject.rb', line 26 def self.factory(type, *args) klass = @types[type] raise NotImplementedError, "Object type not supported: #{type}" if !klass klass.new(*args) end |
.inherited(subclass) ⇒ Object
22 23 24 |
# File 'lib/gitrb/gitobject.rb', line 22 def self.inherited(subclass) @types[subclass.name[7..-1].downcase] = subclass end |
Instance Method Details
#==(other) ⇒ Object
16 17 18 |
# File 'lib/gitrb/gitobject.rb', line 16 def ==(other) self.class === other && id == other.id end |
#git_object ⇒ Object
12 13 14 |
# File 'lib/gitrb/gitobject.rb', line 12 def git_object self end |