Class: Contacts::Contact
- Inherits:
-
Object
- Object
- Contacts::Contact
- Defined in:
- lib/contacts.rb
Instance Attribute Summary collapse
-
#emails ⇒ Object
readonly
Returns the value of attribute emails.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #email ⇒ Object
-
#initialize(emails, name, username = "") ⇒ Contact
constructor
A new instance of Contact.
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
#emails ⇒ Object (readonly)
Returns the value of attribute emails.
26 27 28 |
# File 'lib/contacts.rb', line 26 def emails @emails end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
26 27 28 |
# File 'lib/contacts.rb', line 26 def name @name end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
26 27 28 |
# File 'lib/contacts.rb', line 26 def username @username end |
Instance Method Details
#email ⇒ Object
34 35 36 |
# File 'lib/contacts.rb', line 34 def email @emails.first end |