-
Notifications
You must be signed in to change notification settings - Fork 0
/
contact.rb
42 lines (31 loc) · 850 Bytes
/
contact.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
class Contact
attr_accessor :name, :email
def initialize(name, email)
# TODO: assign local variables to instance variables
@name = name
@email = email
@number = number
end
def to_s
# TODO: return string representation of Contact
@name.to_s + " " + ","+ " " + @email.to_s
end
## Class Methods
class << self
def create(contact)
# TODO: Will initialize a contact as well as add it to the list of contacts
ContactDatabase.add(contact)
end
def find(term)
# TODO: Will find and return contacts that contain the term in the first name, last name or email
end
def all
# TODO: Return the list of contacts, as is
ContactDatabase.read
end
def show(id)
# TODO: Show a contact, based on ID
#ContactDatabase.show
end
end
end