Skip to content

Instantly share code, notes, and snippets.

@Watson1978
Created July 26, 2012 01:35
Show Gist options
  • Save Watson1978/3179756 to your computer and use it in GitHub Desktop.
Save Watson1978/3179756 to your computer and use it in GitHub Desktop.
MacRuby : Mountain Lion + Notification
#
# AppDelegate.rb
# notify
#
# Created by watson on 2012/07/26.
#
module Notification
module_function
def send(title, text)
notification = NSUserNotification.alloc.init
notification.title = title
notification.informativeText = text
center = NSUserNotificationCenter.defaultUserNotificationCenter
center.scheduleNotification(notification)
end
end
class AppDelegate
attr_accessor :window
def applicationDidFinishLaunching(a_notification)
Notification.send("title", "text")
end
end
@mrmurphy
Copy link

Thanks for posting this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment