Retrieving Twitter account from Mac OS X Lion's Address Book via MacRuby
https://gist.github.com/1357224
me = address_book.me
account = (0..me.socialProfile.count).each {|i| break me.socialProfile.valueAtIndex(i)['username'] if me.socialProfile.valueAtIndex(i)['serviceName'] == 'Twitter' } || me.nickname
The code assumes Mac OS X 10.7. Also, the code could be represented differently (i.e. without using a Range) if ABMutableMultiValue behaved like a Ruby Array or supported .to_a
Written by Edward J. Stembler
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Twitter
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#