Skip to content

Commit eb89cd5

Browse files
committed
Fix author initialization code.
1 parent ad86038 commit eb89cd5

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/git/author.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@ module Git
22
class Author
33
attr_accessor :name, :email, :date
44

5-
def initialize(author_string)
5+
def initialize(author_string = nil)
66
if m = /(.*?) <(.*?)> (\d+) (.*)/.match(author_string)
77
@name = m[1]
88
@email = m[2]
99
@date = Time.at(m[3].to_i)
1010
end
1111
end
1212

13-
def initialize(name, email, date = Time.now)
14-
@name = name
15-
@email = email
16-
@date = date
13+
def self.from_parts(name, email, date = Time.now)
14+
a = Author.new
15+
a.name = name
16+
a.email = email
17+
a.date = date
18+
return a
1719
end
1820
end
1921
end

0 commit comments

Comments
 (0)