Class: MotionWiretap::WiretapNotification
- Defined in:
- lib/motion-wiretap/all/wiretap.rb
Instance Method Summary collapse
-
#initialize(notification, object, block) ⇒ WiretapNotification
constructor
A new instance of WiretapNotification.
- #notify(notification) ⇒ Object
- #teardown ⇒ Object
Methods inherited from Wiretap
#and_then, #cancel!, #combine, #dealloc, #enqueue, #filter, #listen, #map, #on_error, #queue, #reduce, #trigger_changed, #trigger_changed_on, #trigger_completed, #trigger_completed_on, #trigger_error, #trigger_error_on
Constructor Details
#initialize(notification, object, block) ⇒ WiretapNotification
Returns a new instance of WiretapNotification.
436 437 438 439 440 441 442 |
# File 'lib/motion-wiretap/all/wiretap.rb', line 436 def initialize(notification, object, block) @notification = notification @object = object NSNotificationCenter.defaultCenter.addObserver(self, selector: 'notify:', name: @notification, object: @object) listen(&block) if block end |
Instance Method Details
#notify(notification) ⇒ Object
444 445 446 |
# File 'lib/motion-wiretap/all/wiretap.rb', line 444 def notify(notification) trigger_changed(notification.object, notification.userInfo) end |
#teardown ⇒ Object
448 449 450 451 |
# File 'lib/motion-wiretap/all/wiretap.rb', line 448 def teardown NSNotificationCenter.defaultCenter.removeObserver(self, name: @notification, object: @object) super end |