Created
July 26, 2012 01:35
-
-
Save Watson1978/3179756 to your computer and use it in GitHub Desktop.
MacRuby : Mountain Lion + Notification
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for posting this!