Class: Git::Object

Inherits:
Object
  • Object
show all
Defined in:
lib/git/object.rb

Overview

represents a git object

Defined Under Namespace

Classes: AbstractObject, Blob, Commit, Tag, Tree

Class Method Summary collapse

Class Method Details

.new(base, objectish, type = nil, is_tag = false)

if we're calling this, we don't know what type it is yet so this is our little factory method

 316 317 318 319 320 321 322 323 324 325 326 327 328
# File 'lib/git/object.rb', line 316 def self.new(base, objectish, type = nil, is_tag = false) # rubocop:disable Style/OptionalBooleanParameter  return new_tag(base, objectish) if is_tag type ||= base.lib.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