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.
447 448 449 450 451 452 453 |
# File 'lib/motion-wiretap/all/wiretap.rb', line 447 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
455 456 457 |
# File 'lib/motion-wiretap/all/wiretap.rb', line 455 def notify(notification) trigger_changed(notification.object, notification.userInfo) end |
#teardown ⇒ Object
459 460 461 462 |
# File 'lib/motion-wiretap/all/wiretap.rb', line 459 def teardown NSNotificationCenter.defaultCenter.removeObserver(self, name: @notification, object: @object) super end |