Class: Git::Object
- Inherits:
-
Object
- Object
- Git::Object
- Defined in:
- lib/git/object.rb
Overview
represents a git object
Defined Under Namespace
Classes: AbstractObject, Blob, Commit, Tag, Tree
Class Method Summary collapse
-
.new(base, objectish, type = nil, is_tag = false) ⇒ Object
if we’re calling this, we don’t know what type it is yet so this is our little factory method.
Class Method Details
.new(base, objectish, type = nil, is_tag = false) ⇒ Object
if we’re calling this, we don’t know what type it is yet so this is our little factory method
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
# File 'lib/git/object.rb', line 255 def self.new(base, objectish, type = nil, is_tag = false) if is_tag sha = base.lib.tag_sha(objectish) if sha == '' raise Git::GitTagNameDoesNotExist.new(objectish) end return Git::Object::Tag.new(base, sha, objectish) end type ||= base.lib.object_type(objectish) klass = case type when /blob/ then Blob when /commit/ then Commit when /tree/ then Tree end klass.new(base, objectish) end |