Class: MotionWiretap::WiretapNotification
- Defined in:
- lib/motion-wiretap/all/wiretap.rb
Instance Attribute Summary
Attributes inherited from Wiretap
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.
448 449 450 451 452 453 454 |
# File 'lib/motion-wiretap/all/wiretap.rb', line 448 def initialize(notification, object, block) super(&block) @notification = notification @object = object NSNotificationCenter.defaultCenter.addObserver(self, selector: 'notify:', name: @notification, object: @object) end |
Instance Method Details
#notify(notification) ⇒ Object
456 457 458 |
# File 'lib/motion-wiretap/all/wiretap.rb', line 456 def notify(notification) trigger_changed(notification.object, notification.userInfo) end |
#teardown ⇒ Object
460 461 462 463 |
# File 'lib/motion-wiretap/all/wiretap.rb', line 460 def teardown NSNotificationCenter.defaultCenter.removeObserver(self, name: @notification, object: @object) super end |