Class: Chronicle::Imessage::LocalContacts
- Inherits:
-
Object
- Object
- Chronicle::Imessage::LocalContacts
- Defined in:
- lib/chronicle/imessage/local_contacts.rb
Overview
Load contacts from local macOS address book
Instance Method Summary collapse
- #contact_identifier_to_details(identifier) ⇒ Object
- #contacts ⇒ Object
-
#initialize ⇒ LocalContacts
constructor
A new instance of LocalContacts.
- #my_icloud_account ⇒ Object
- #my_phone_contact ⇒ Object
Constructor Details
#initialize ⇒ LocalContacts
Returns a new instance of LocalContacts.
8 9 10 11 |
# File 'lib/chronicle/imessage/local_contacts.rb', line 8 def initialize filename = find_local_icloud_address_book @db = SQLite3::Database.new(filename, results_as_hash: true) end |
Instance Method Details
#contact_identifier_to_details(identifier) ⇒ Object
13 14 15 |
# File 'lib/chronicle/imessage/local_contacts.rb', line 13 def contact_identifier_to_details(identifier) contacts[identifier] end |
#contacts ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/chronicle/imessage/local_contacts.rb', line 17 def contacts @contacts ||= begin c = {} c.merge!(load_phone_numbers) c.merge!(load_email_addresses) c end end |
#my_icloud_account ⇒ Object
30 31 32 |
# File 'lib/chronicle/imessage/local_contacts.rb', line 30 def my_icloud_account @my_icloud_account ||= load_my_icloud_account end |
#my_phone_contact ⇒ Object
26 27 28 |
# File 'lib/chronicle/imessage/local_contacts.rb', line 26 def my_phone_contact @my_phone_contact ||= load_my_phone_contact end |