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) ⇒ Git::Object::AbstractObject
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) ⇒ Git::Object::AbstractObject
if we're calling this, we don't know what type it is yet so this is our little factory method
638 639 640 641 642 643 644 645 646 647 648 649 650 |
# File 'lib/git/object.rb', line 638 def self.new(base, objectish, type = nil, is_tag = false) # rubocop:disable Style/OptionalBooleanParameter return new_tag(base, objectish) if is_tag type ||= object_repository_for(base).cat_file_type(objectish) # TODO: why not handle tag case here too? klass = case type when /blob/ then Blob when /commit/ then Commit when /tree/ then Tree end klass.new(base, objectish) end |