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

Methods

archive   blob?   commit?   contents   contents_array   diff   grep   log   new   setup   sha   size   tag?   to_s   tree?  

Attributes

mode  [RW] 
objectish  [RW] 
size  [RW] 
type  [RW] 

Public Class methods

[Source]

# File lib/git/object.rb, line 17
      def initialize(base, objectish)
        @base = base
        @objectish = objectish.to_s
        setup
      end

Public Instance methods

creates an archive of this object (tree)

[Source]

# File lib/git/object.rb, line 63
      def archive(file = nil, opts = {})
        @base.lib.archive(@objectish, file, opts)
      end

[Source]

# File lib/git/object.rb, line 71
      def blob?
        @type == 'blob'
      end

[Source]

# File lib/git/object.rb, line 75
      def commit?
        @type == 'commit'
      end

caches the contents of this call in memory

[Source]

# File lib/git/object.rb, line 32
      def contents
        @contents || @contents = @base.lib.object_contents(@objectish)
      end

[Source]

# File lib/git/object.rb, line 36
      def contents_array
        self.contents.split("\n")
      end

[Source]

# File lib/git/object.rb, line 54
      def diff(objectish)
        Git::Diff.new(@base, @objectish, objectish)
      end

[Source]

# File lib/git/object.rb, line 48
      def grep(string, path_limiter = nil, opts = {})
        default = {:object => sha, :path_limiter => path_limiter}
        grep_options = default.merge(opts)
        @base.lib.grep(string, grep_options)
      end

[Source]

# File lib/git/object.rb, line 58
      def log(count = 30)
        Git::Log.new(@base, count).object(@objectish)
      end

[Source]

# File lib/git/object.rb, line 40
      def setup
        raise NotImplementedError
      end

[Source]

# File lib/git/object.rb, line 23
      def sha
        @sha || @sha = @base.lib.revparse(@objectish)
      end

[Source]

# File lib/git/object.rb, line 27
      def size
        @size || @size = @base.lib.object_size(@objectish)
      end

[Source]

# File lib/git/object.rb, line 79
     def tag?
       @type == 'tag'
     end

[Source]

# File lib/git/object.rb, line 44
      def to_s
        @objectish
      end

[Source]

# File lib/git/object.rb, line 67
      def tree?
        @type == 'tree'
      end

[Validate]