Class: Git::Author Deprecated

Inherits:
Object
  • Object
show all
Defined in:
lib/git/author.rb

Overview

Deprecated.

Use AuthorInfo instead; this mutable class will be removed in v6.0.0

An author in a Git commit

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(author_string)

Deprecated.

Initializes a new Author object from a string

Examples:

Git::Author.new("John Doe <[email protected]> 1627849923 +0200")

Parameters:

  • author_string (String)

    the author string



32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/git/author.rb', line 32

def initialize(author_string)
  if defined?(Git::Deprecation)
    Git::Deprecation.warn(
      'Git::Author is deprecated and will be removed in v6.0.0. Use Git::AuthorInfo instead.'
    )
  end

  return unless (m = /(.*?) <(.*?)> (\d+) (.*)/.match(author_string))

  @name = m[1]
  @email = m[2]
  @date = Time.at(m[3].to_i)
end

Instance Attribute Details

#dateTime?

Returns the date the change was authored (author date, not committer date).

Returns:

  • (Time, nil)

    the date the change was authored (author date, not committer date)



19
20
21
# File 'lib/git/author.rb', line 19

def date
  @date
end

#emailString?

Returns the author's email.

Returns:

  • (String, nil)

    the author's email



16
17
18
# File 'lib/git/author.rb', line 16

def email
  @email
end

#nameString?

Returns the author's name.

Returns:

  • (String, nil)

    the author's name



13
14
15
# File 'lib/git/author.rb', line 13

def name
  @name
end