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
687 688 689 690 691 692 693 694 695 696 697 698 699 |
# File 'lib/git/object.rb', line 687 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 |