Sha256: 40b4b36e05baf64e41258e0355fd785725ead9363609c56ac0a3c468f75a0f06
Contents?: true
Size: 794 Bytes
Versions: 2
Compression:
Stored size: 794 Bytes
Contents
class NSString def post_notification(object=nil, user_info=nil) if user_info and not user_info.is_a? Hash 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sugarcube-0.9.2 | lib/sugarcube/notifications.rb |
sugarcube-0.9.1 | lib/sugarcube/notifications.rb |