Class Grit::GitRuby::UserInfo
In: lib/grit/git-ruby/git_object.rb
lib/grit/git-ruby/object.rb
Parent: Object

class for author/committer/tagger lines

Methods

new   new   to_s   to_s  

Attributes

date  [RW] 
date  [RW] 
email  [RW] 
email  [RW] 
name  [RW] 
name  [RW] 
offset  [RW] 
offset  [RW] 

Public Class methods

[Source]

    # File lib/grit/git-ruby/git_object.rb, line 23
23:     def initialize(str)
24:       @email = ''
25:       @date = Time.now
26:       @offset = 0
27:       
28:       m = /^(.*?) <(.*)> (\d+) ([+-])0*(\d+?)$/.match(str)
29:       if !m
30:         case str
31:         when /<.+>/
32:           m, @name, @email = *str.match(/(.*) <(.+?)>/)
33:         else
34:           @name = str
35:         end
36:       else
37:         @name = m[1]
38:         @email = m[2]
39:         @date = Time.at(Integer(m[3]))
40:         @offset = (m[4] == "-" ? -1 : 1)*Integer(m[5])
41:       end
42:     end

[Source]

    # File lib/grit/git-ruby/object.rb, line 23
23:     def initialize(str)
24:       m = /^(.*?) <(.*)> (\d+) ([+-])0*(\d+?)$/.match(str)
25:       if !m
26:         raise RuntimeError, "invalid header '%s' in commit" % str
27:       end
28:       @name = m[1]
29:       @email = m[2]
30:       @date = Time.at(Integer(m[3]))
31:       @offset = (m[4] == "-" ? -1 : 1)*Integer(m[5])
32:     end

Public Instance methods

[Source]

    # File lib/grit/git-ruby/git_object.rb, line 44
44:     def to_s
45:       "%s <%s> %s %+05d" % [@name, @email, @date.to_i, @offset]
46:     end

[Source]

    # File lib/grit/git-ruby/object.rb, line 34
34:     def to_s
35:       "%s <%s> %s %+05d" % [@name, @email, @date.to_i, @offset]
36:     end

[Validate]