Watson1978
7/26/2012 - 1:35 AM

MacRuby : Mountain Lion + Notification

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