Class: MotionWiretap::WiretapNotification

Inherits:
Wiretap
  • Object
show all
Defined in:
lib/motion-wiretap/all/wiretap.rb

Instance Attribute Summary

Attributes inherited from Wiretap

#value

Instance Method Summary collapse

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

#teardownObject



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