Class: Contacts::Contact

Inherits:
Object
  • Object
show all
Defined in:
lib/contacts.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(emails, name, username = "") ⇒ Contact

Returns a new instance of Contact.



28
29
30
31
32
# File 'lib/contacts.rb', line 28

def initialize(emails, name, username = "")
  @name = name
  @emails = Array(emails)
  @username = username
end

Instance Attribute Details

#emailsObject (readonly)

Returns the value of attribute emails.



26
27
28
# File 'lib/contacts.rb', line 26

def emails
  @emails
end

#nameObject (readonly)

Returns the value of attribute name.



26
27
28
# File 'lib/contacts.rb', line 26

def name
  @name
end

#usernameObject (readonly)

Returns the value of attribute username.



26
27
28
# File 'lib/contacts.rb', line 26

def username
  @username
end

Instance Method Details

#emailObject



34
35
36
# File 'lib/contacts.rb', line 34

def email
  @emails.first
end