class Git::Log::Result
An immutable collection of commits returned by Git::Log#execute
This object is an Enumerable that contains Git::Object::Commit
objects. It provides methods to access the commit data without executing any further git commands.
@api public
Public Class Methods
Source
# File lib/git/log.rb, line 41 def initialize(commits) @commits = commits end
@private
Public Instance Methods
Source
# File lib/git/log.rb, line 69 def [](index) @commits[index] end
@param index [Integer] the index of the commit to return @return [Git::Object::Commit, nil] the commit at the given index
Source
# File lib/git/log.rb, line 53 def each(&block) @commits.each(&block) end
Iterates over each commit in the result set
@yield [Git::Object::Commit]
Source
# File lib/git/log.rb, line 58 def first @commits.first end
@return [Git::Object::Commit, nil] the first commit in the result set
Source
# File lib/git/log.rb, line 63 def last @commits.last end
@return [Git::Object::Commit, nil] the last commit in the result set
Source
# File lib/git/log.rb, line 46 def size @commits.size end
@return [Integer] the number of commits in the result set
Source
# File lib/git/log.rb, line 74 def to_s map { |c| c.to_s }.join("\n") end
@return [String] a string representation of the log