Class: Git::Log
Overview
object that holds the last X commits on given branch
Instance Method Summary collapse
- #author(regex) ⇒ Object
- #between(sha1, sha2 = nil) ⇒ Object
- #each(&block) ⇒ Object
- #first ⇒ Object
- #grep(regex) ⇒ Object
-
#initialize(base, count = 30) ⇒ Log
constructor
A new instance of Log.
- #object(objectish) ⇒ Object
- #path(path) ⇒ Object
- #since(date) ⇒ Object
-
#size ⇒ Object
forces git log to run.
- #skip(num) ⇒ Object
- #to_s ⇒ Object
- #until(date) ⇒ Object
Constructor Details
#initialize(base, count = 30) ⇒ Log
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# 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 end |
Instance Method Details
#author(regex) ⇒ Object
29 30 31 32 33 |
# File 'lib/git/log.rb', line 29 def (regex) dirty_log @author = regex return self end |
#between(sha1, sha2 = nil) ⇒ Object
65 66 67 68 69 |
# File 'lib/git/log.rb', line 65 def between(sha1, sha2 = nil) dirty_log @between = [sha1, sha2] return self end |
#each(&block) ⇒ Object
83 84 85 86 |
# File 'lib/git/log.rb', line 83 def each(&block) check_log @commits.each(&block) end |
#first ⇒ Object
88 89 90 91 |
# File 'lib/git/log.rb', line 88 def first check_log @commits.first rescue nil end |
#grep(regex) ⇒ Object
35 36 37 38 39 |
# File 'lib/git/log.rb', line 35 def grep(regex) dirty_log @grep = regex return self end |
#object(objectish) ⇒ Object
23 24 25 26 27 |
# File 'lib/git/log.rb', line 23 def object(objectish) dirty_log @object = objectish return self end |
#path(path) ⇒ Object
41 42 43 44 45 |
# File 'lib/git/log.rb', line 41 def path(path) dirty_log @path = path return self end |
#since(date) ⇒ Object
53 54 55 56 57 |
# File 'lib/git/log.rb', line 53 def since(date) dirty_log @since = date return self end |
#size ⇒ Object
forces git log to run
78 79 80 81 |
# File 'lib/git/log.rb', line 78 def size check_log @commits.size rescue nil end |
#skip(num) ⇒ Object
47 48 49 50 51 |
# File 'lib/git/log.rb', line 47 def skip(num) dirty_log @skip = num return self end |
#to_s ⇒ Object
71 72 73 |
# File 'lib/git/log.rb', line 71 def to_s self.map { |c| c.to_s }.join("\n") end |