Class: Contacts::Contact

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, emails) ⇒ Contact

Returns a new instance of Contact.



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

def initialize(name, emails)
  @name = name
  @emails = Array(emails)
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



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

def email
  @emails.first
end