Class Git::Object
In: lib/git/object.rb
Parent: Object

represents a git object

Methods

new  

Classes and Modules

Class Git::Object::AbstractObject
Class Git::Object::Blob
Class Git::Object::Commit
Class Git::Object::Tag
Class Git::Object::Tree

Public Class methods

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

[Source]

# File lib/git/object.rb, line 256
      def 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 Tag.new(base, sha, objectish)
        else
          if !type
            type = base.lib.object_type(objectish) 
          end
        end
        
        klass =
          case type
          when /blob/:   Blob   
          when /commit/: Commit
          when /tree/:   Tree
          end
        klass::new(base, objectish)
      end

[Validate]