Class: SugarCubeNotificationForgetter

Inherits:
Object
  • Object
show all
Defined in:
lib/ios/sugarcube-events/uitextview.rb

Instance Method Summary collapse

Constructor Details

#initializeSugarCubeNotificationForgetter



87
88
89
# File 'lib/ios/sugarcube-events/uitextview.rb', line 87

def initialize
  @observers = []
end

Instance Method Details

#<<(observer) ⇒ Object



91
92
93
# File 'lib/ios/sugarcube-events/uitextview.rb', line 91

def <<(observer)
  @observers << observer
end

#deallocObject



108
109
110
# File 'lib/ios/sugarcube-events/uitextview.rb', line 108

def dealloc
  self.remove_all
end

#remove(callback_observer) ⇒ Object



102
103
104
105
106
# File 'lib/ios/sugarcube-events/uitextview.rb', line 102

def remove(callback_observer)
  if @observers.delete(callback_observer)
    NSNotificationCenter.defaultCenter.removeObserver(callback_observer)
  end
end

#remove_allObject



95
96
97
98
99
100
# File 'lib/ios/sugarcube-events/uitextview.rb', line 95

def remove_all
  @observers.each do |callback_observer|
    self.remove(callback_observer)
  end
  @observers = []
end