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.



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

#teardownObject



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