Sha256: 33d1e79407aefa9155eeadfbb576ccf4bbab4dd40bd1350a925ff7c47770593b
Contents?: true
Size: 792 Bytes
Versions: 3
Compression:
Stored size: 792 Bytes
Contents
class NSString def post_notification(object=nil, user_info=nil) if user_info and not Hash === user_info raise TypeError("Invalid argument #{user_info.class.name} sent to String.post_notification") end if user_info NSNotificationCenter.defaultCenter.postNotificationName(self, object:object, userInfo:user_info) else NSNotificationCenter.defaultCenter.postNotificationName(self, object:object) end end def add_observer(observer, message, object=nil) NSNotificationCenter.defaultCenter.addObserver(observer, selector: message, name: self, object: object) end def remove_observer(observer, object=nil) NSNotificationCenter.defaultCenter.removeObserver(observer, name:self, object:object) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sugarcube-0.9 | lib/sugarcube/notifications.rb |
sugarcube-0.8.7 | lib/sugarcube/notifications.rb |
sugarcube-0.8.6 | lib/sugarcube/notifications.rb |