Q:

Tell Mail.app to check for new mail with MacRuby

I want to use MacRuby to tell Mail.app to check for new email.  But I cannot figure out how to go about this after I get an application reference using SBApplication. 
I have the following simple script:
#! /usr/local/bin/macruby
framework 'ScriptingBridge'

mail = SBApplication.applicationWithBundleIdentifier("com.apple.mail")
# mail.check_for_new_mail? 

Basically I want to do the following AppleScript in MacRuby:
tell application "Mail"
    check for new mail
end tell

Yes, I can just use the AppleScript.  But I much prefer Ruby. 

A:

#! /usr/local/bin/macruby
framework 'ScriptingBridge'

mail = SBApplication.applicationWithBundleIdentifier("com.apple.mail")
mail.accounts.each {|account| mail.checkForNewMailFor(account) }

tip: use puts (mail.methods(true,true) - Object.new.methods) which returns available cocoa only methods list for object and ancestors

