Class: Git::Log
Overview
object that holds the last X commits on given branch
Instance Method Summary collapse
- #[](index)
- #author(regex)
- #between(sha1, sha2 = nil)
- #cherry
- #each(&block)
- #first
- #grep(regex)
-
#initialize(base, count = 30) ⇒ Log
constructor
A new instance of Log.
- #last
- #object(objectish)
- #path(path)
- #since(date)
-
#size
forces git log to run.
- #skip(num)
- #to_s
- #until(date)
Constructor Details
#initialize(base, count = 30) ⇒ Log
Returns a new instance of Log.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/git/log.rb', line 7 def initialize(base, count = 30) dirty_log @base = base @count = count @commits = nil @author = nil @grep = nil @object = nil @path = nil @since = nil @skip = nil @until = nil @between = nil @cherry = nil end |
Instance Method Details
#[](index)
105 106 107 108 |
# File 'lib/git/log.rb', line 105 def [](index) check_log @commits[index] rescue nil end |
#author(regex)
30 31 32 33 34 |
# File 'lib/git/log.rb', line 30 def (regex) dirty_log @author = regex return self end |
#between(sha1, sha2 = nil)
66 67 68 69 70 |
# File 'lib/git/log.rb', line 66 def between(sha1, sha2 = nil) dirty_log @between = [sha1, sha2] return self end |
#cherry
72 73 74 75 76 |
# File 'lib/git/log.rb', line 72 def cherry dirty_log @cherry = true return self end |
#each(&block)
90 91 92 93 |
# File 'lib/git/log.rb', line 90 def each(&block) check_log @commits.each(&block) end |
#first
95 96 97 98 |
# File 'lib/git/log.rb', line 95 def first check_log @commits.first rescue nil end |
#grep(regex)
36 37 38 39 40 |
# File 'lib/git/log.rb', line 36 def grep(regex) dirty_log @grep = regex return self end |
#last
100 101 102 103 |
# File 'lib/git/log.rb', line 100 def last check_log @commits.last rescue nil end |
#object(objectish)
24 25 26 27 28 |
# File 'lib/git/log.rb', line 24 def object(objectish) dirty_log @object = objectish return self end |
#path(path)
42 43 44 45 46 |
# File 'lib/git/log.rb', line 42 def path(path) dirty_log @path = path return self end |
#since(date)
54 55 56 57 58 |
# File 'lib/git/log.rb', line 54 def since(date) dirty_log @since = date return self end |
#size
forces git log to run
85 86 87 88 |
# File 'lib/git/log.rb', line 85 def size check_log @commits.size rescue nil end |
#skip(num)
48 49 50 51 52 |
# File 'lib/git/log.rb', line 48 def skip(num) dirty_log @skip = num return self end |
#to_s
78 79 80 |
# File 'lib/git/log.rb', line 78 def to_s self.map { |c| c.to_s }.join("\n") end |
#until(date)
60 61 62 63 64 |
# File 'lib/git/log.rb', line 60 def until(date) dirty_log @until = date return self end |