Class: Meow::Notifier
- Inherits:
-
OSX::NSObject
- Object
- OSX::NSObject
- Meow::Notifier
- Defined in:
- lib/meow/notifier.rb
Overview
addObserver can only be used with subclasses of NSObject, so we use this one.
Instance Method Summary collapse
- #add(prc) ⇒ Object
- #clicked(notification) ⇒ Object
- #empty? ⇒ Boolean
- #setup ⇒ Object
- #timeout(notification) ⇒ Object
Instance Method Details
#add(prc) ⇒ Object
13 14 15 16 17 |
# File 'lib/meow/notifier.rb', line 13 def add(prc) pos = prc.object_id @callbacks[pos] = prc return pos end |
#clicked(notification) ⇒ Object
19 20 21 22 23 |
# File 'lib/meow/notifier.rb', line 19 def clicked(notification) if block = remove_callback(notification) block.call end end |
#empty? ⇒ Boolean
9 10 11 |
# File 'lib/meow/notifier.rb', line 9 def empty? @callbacks.empty? end |
#setup ⇒ Object
5 6 7 |
# File 'lib/meow/notifier.rb', line 5 def setup @callbacks = {} end |
#timeout(notification) ⇒ Object
25 26 27 |
# File 'lib/meow/notifier.rb', line 25 def timeout(notification) remove_callback(notification) end |