Class: Contacts::Contact
- Inherits:
-
Object
- Object
- Contacts::Contact
- Defined in:
- lib/contacts.rb
Overview
An object that represents a single contact
Instance Attribute Summary collapse
-
#addresses ⇒ Object
Returns the value of attribute addresses.
-
#emails ⇒ Object
Returns the value of attribute emails.
-
#firstname ⇒ Object
readonly
Returns the value of attribute firstname.
-
#ims ⇒ Object
Returns the value of attribute ims.
-
#lastname ⇒ Object
readonly
Returns the value of attribute lastname.
-
#name ⇒ Object
Returns the value of attribute name.
-
#note ⇒ Object
Returns the value of attribute note.
-
#organizations ⇒ Object
readonly
Returns the value of attribute organizations.
-
#phones ⇒ Object
Returns the value of attribute phones.
-
#service_id ⇒ Object
Returns the value of attribute service_id.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #email ⇒ Object
-
#initialize(email, name = nil, username = nil, firstname = nil, lastname = nil) ⇒ Contact
constructor
A new instance of Contact.
- #inspect ⇒ Object
Constructor Details
#initialize(email, name = nil, username = nil, firstname = nil, lastname = nil) ⇒ Contact
Returns a new instance of Contact.
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/contacts.rb', line 14 def initialize(email, name = nil, username = nil, firstname = nil, lastname = nil) @emails = [] @emails << email if email @ims = [] @phones = [] @addresses = [] @organizations = [] @name = name @username = username @firstname = firstname @lastname = lastname end |
Instance Attribute Details
#addresses ⇒ Object
Returns the value of attribute addresses.
12 13 14 |
# File 'lib/contacts.rb', line 12 def addresses @addresses end |
#emails ⇒ Object
Returns the value of attribute emails.
12 13 14 |
# File 'lib/contacts.rb', line 12 def emails @emails end |
#firstname ⇒ Object (readonly)
Returns the value of attribute firstname.
11 12 13 |
# File 'lib/contacts.rb', line 11 def firstname @firstname end |
#ims ⇒ Object
Returns the value of attribute ims.
12 13 14 |
# File 'lib/contacts.rb', line 12 def ims @ims end |
#lastname ⇒ Object (readonly)
Returns the value of attribute lastname.
11 12 13 |
# File 'lib/contacts.rb', line 11 def lastname @lastname end |
#name ⇒ Object
Returns the value of attribute name.
12 13 14 |
# File 'lib/contacts.rb', line 12 def name @name end |
#note ⇒ Object
Returns the value of attribute note.
12 13 14 |
# File 'lib/contacts.rb', line 12 def note @note end |
#organizations ⇒ Object (readonly)
Returns the value of attribute organizations.
11 12 13 |
# File 'lib/contacts.rb', line 11 def organizations @organizations end |
#phones ⇒ Object
Returns the value of attribute phones.
12 13 14 |
# File 'lib/contacts.rb', line 12 def phones @phones end |
#service_id ⇒ Object
Returns the value of attribute service_id.
12 13 14 |
# File 'lib/contacts.rb', line 12 def service_id @service_id end |
#username ⇒ Object
Returns the value of attribute username.
12 13 14 |
# File 'lib/contacts.rb', line 12 def username @username end |
Instance Method Details
#email ⇒ Object
27 28 29 |
# File 'lib/contacts.rb', line 27 def email @emails.first end |
#inspect ⇒ Object
31 32 33 |
# File 'lib/contacts.rb', line 31 def inspect %!#<Contacts::Contact "#{name}"#{email ? " (#{email})" : ''}>! end |