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.



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

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

Instance Attribute Details

#emailsObject (readonly)

Returns the value of attribute emails.



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

def emails
  @emails
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#usernameObject (readonly)

Returns the value of attribute username.



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

def username
  @username
end

Instance Method Details

#emailObject



38
39
40
# File 'lib/contacts.rb', line 38

def email
  @emails.first
end