Class: SugarCubeNotificationForgetter
- Defined in:
- lib/ios/sugarcube-events/uitextview.rb
Instance Method Summary collapse
- #<<(observer) ⇒ Object
- #dealloc ⇒ Object
-
#initialize ⇒ SugarCubeNotificationForgetter
constructor
A new instance of SugarCubeNotificationForgetter.
- #remove(callback_observer) ⇒ Object
- #remove_all ⇒ Object
Constructor Details
#initialize ⇒ SugarCubeNotificationForgetter
Returns a new instance of SugarCubeNotificationForgetter.
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 |
#dealloc ⇒ Object
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_all ⇒ Object
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 |