Class: Author

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/gitstats/author.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, email) ⇒ Author

Returns a new instance of Author.



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

def initialize(name, email)
  @name = name
  @email = email
end

Instance Attribute Details

#emailObject (readonly)

Returns the value of attribute email.



14
15
16
# File 'lib/gitstats/author.rb', line 14

def email
  @email
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

Class Method Details

.include_mailObject



8
9
10
11
# File 'lib/gitstats/author.rb', line 8

def self.include_mail
  @@include_mail ||= false
  @@include_mail
end

.include_mail=(include_mail) ⇒ Object



4
5
6
# File 'lib/gitstats/author.rb', line 4

def self.include_mail=(include_mail)
  @@include_mail = include_mail
end

Instance Method Details

#eql?(b) ⇒ Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/gitstats/author.rb', line 29

def eql?(b)
  to_s.hash == b.to_s.hash
end

#hashObject



33
34
35
# File 'lib/gitstats/author.rb', line 33

def hash
  to_s.hash
end

#to_sObject



21
22
23
24
25
26
27
# File 'lib/gitstats/author.rb', line 21

def to_s
  if self.class.include_mail
    "#{name} <#{email}>"
  else
    name
  end
end