Class: Person
- Inherits:
-
Object
- Object
- Person
- Defined in:
- worklog/person.rb
Overview
Represents a person at work.
Instance Attribute Summary collapse
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#handle ⇒ Object
readonly
Returns the value of attribute handle.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#notes ⇒ Object
readonly
Returns the value of attribute notes.
-
#team ⇒ Object
readonly
Returns the value of attribute team.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(handle, name, email, team, notes = []) ⇒ Person
constructor
A new instance of Person.
- #to_s ⇒ Object
Constructor Details
#initialize(handle, name, email, team, notes = []) ⇒ Person
Returns a new instance of Person.
7 8 9 10 11 12 13 |
# File 'worklog/person.rb', line 7 def initialize(handle, name, email, team, notes = []) @handle = handle @name = name @email = email @team = team @notes = notes end |
Instance Attribute Details
#email ⇒ Object (readonly)
Returns the value of attribute email.
5 6 7 |
# File 'worklog/person.rb', line 5 def email @email end |
#handle ⇒ Object (readonly)
Returns the value of attribute handle.
5 6 7 |
# File 'worklog/person.rb', line 5 def handle @handle end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'worklog/person.rb', line 5 def name @name end |
#notes ⇒ Object (readonly)
Returns the value of attribute notes.
5 6 7 |
# File 'worklog/person.rb', line 5 def notes @notes end |
#team ⇒ Object (readonly)
Returns the value of attribute team.
5 6 7 |
# File 'worklog/person.rb', line 5 def team @team end |
Instance Method Details
#==(other) ⇒ Object
19 20 21 22 23 |
# File 'worklog/person.rb', line 19 def ==(other) return false unless other.is_a?(Person) handle == other.handle && name == other.name && email == other.email && team == other.team && notes == other.notes end |
#to_s ⇒ Object
15 16 17 |
# File 'worklog/person.rb', line 15 def to_s "#{name} (~#{handle}) <#{email}>" end |