Class: Author
Instance Attribute Summary collapse
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(b) ⇒ Object
- #eql?(b) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(name, email) ⇒ Author
constructor
A new instance of Author.
- #to_s ⇒ Object
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
#email ⇒ Object (readonly)
Returns the value of attribute email.
14 15 16 |
# File 'lib/gitstats/author.rb', line 14 def email @email end |
#name ⇒ Object (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_mail ⇒ Object
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
#<=>(b) ⇒ Object
21 22 23 |
# File 'lib/gitstats/author.rb', line 21 def <=>(b) to_i <=> b.to_i end |
#eql?(b) ⇒ Boolean
33 34 35 |
# File 'lib/gitstats/author.rb', line 33 def eql?(b) to_s.hash == b.to_s.hash end |
#hash ⇒ Object
37 38 39 |
# File 'lib/gitstats/author.rb', line 37 def hash to_s.hash end |
#to_s ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/gitstats/author.rb', line 25 def to_s if self.class.include_mail "#{name} <#{email}>" else name end end |