Class: Person

Inherits:
Object
  • Object
show all
Defined in:
worklog/person.rb

Overview

Represents a person at work.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#emailObject (readonly)

Returns the value of attribute email.



5
6
7
# File 'worklog/person.rb', line 5

def email
  @email
end

#handleObject (readonly)

Returns the value of attribute handle.



5
6
7
# File 'worklog/person.rb', line 5

def handle
  @handle
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'worklog/person.rb', line 5

def name
  @name
end

#notesObject (readonly)

Returns the value of attribute notes.



5
6
7
# File 'worklog/person.rb', line 5

def notes
  @notes
end

#teamObject (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_sObject



15
16
17
# File 'worklog/person.rb', line 15

def to_s
  "#{name} (~#{handle}) <#{email}>"
end