Class: Kernel
- Inherits:
-
Object
- Object
- Kernel
- Defined in:
- motion-prime/core_ext/kernel.rb
Instance Method Summary collapse
- #class_name_without_kvo ⇒ Object
- #clear_instance_variables(options = {}) ⇒ Object
- #pp(*attrs) ⇒ Object
- #strong_ref ⇒ Object
- #weak_ref ⇒ Object
Instance Method Details
#class_name_without_kvo ⇒ Object
6 7 8 |
# File 'motion-prime/core_ext/kernel.rb', line 6 def class_name_without_kvo self.class.name.gsub(/^NSKVONotifying_/, '') end |
#clear_instance_variables(options = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'motion-prime/core_ext/kernel.rb', line 18 def clear_instance_variables( = {}) ivars = self.instance_variables excluded_ivars = Array.wrap([:except]).map(&:to_s) clear_block = proc { |ivar| next if excluded_ivars.include?(ivar[1..-1]) self.instance_variable_set(ivar, nil) }.weak! ivars.each(&clear_block) end |
#pp(*attrs) ⇒ Object
2 3 4 |
# File 'motion-prime/core_ext/kernel.rb', line 2 def pp(*attrs) NSLog([*attrs].map(&:inspect).join(' ')) end |
#strong_ref ⇒ Object
14 15 16 |
# File 'motion-prime/core_ext/kernel.rb', line 14 def strong_ref self end |
#weak_ref ⇒ Object
10 11 12 |
# File 'motion-prime/core_ext/kernel.rb', line 10 def weak_ref WeakRef.new(self) end |