Class: UIResponder

Inherits:
Object show all
Defined in:
lib/sugarcube/sugarcube_cleanup.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.sugarcube_cleanup(&block) ⇒ Object



18
19
20
21
22
23
# File 'lib/sugarcube/sugarcube_cleanup.rb', line 18

def sugarcube_cleanup(&block)
  @sugarcube_cleanup ||= []
  return @sugarcube_cleanup unless block
  @sugarcube_cleanup << block
  return nil
end

Instance Method Details

#sugarcube_cleanupObject



27
28
29
30
31
32
33
34
35
# File 'lib/sugarcube/sugarcube_cleanup.rb', line 27

def sugarcube_cleanup
  self.class.ancestors.each do |klass|
    next unless klass.respond_to?(:sugarcube_cleanup)
    klass.sugarcube_cleanup.each do |block|
      self.instance_eval(&block)
    end
    break if klass == UIResponder
  end
end