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 71
      def archive(file = nil, opts = {})
        @base.lib.archive(@objectish, file, opts)
      end

[Source]

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

[Source]

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

get the object‘s contents if no block is given, the contents are cached in memory and returned as a string if a block is given, it yields an IO object (via IO::popen) which could be used to read a large file in chunks. use this for large files so that they are not held in memory

[Source]

# File lib/git/object.rb, line 36
      def contents(&block)
        if block_given?
          @base.lib.object_contents(@objectish, &block)
        else
          @contents || @contents = @base.lib.object_contents(@objectish)
        end
      end

[Source]

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

[Source]

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

[Source]

# File lib/git/object.rb, line 56
      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 66
      def log(count = 30)
        Git::Log.new(@base, count).object(@objectish)
      end

[Source]

# File lib/git/object.rb, line 48
      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 87
     def tag?
       @type == 'tag'
     end

[Source]

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

[Source]

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

[Validate]