yifs-q
Last Updated: February 25, 2016
·
216
· ejstembler

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