Class: Meow::Notifier

Inherits:
OSX::NSObject
  • Object
show all
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

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

Returns:

  • (Boolean)


9
10
11
# File 'lib/meow/notifier.rb', line 9

def empty?
  @callbacks.empty?
end

#setupObject



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