sugarcube 1.3.2 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sugarcube (1.3.2)
4
+ sugarcube (1.3.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,6 +1,10 @@
1
1
  # Additions to UIControl to support jQuery-style `on` and `off` methods.
2
2
  class UIControl
3
3
 
4
+ sugarcube_cleanup do
5
+ self.off
6
+ end
7
+
4
8
  # Add event handlers to UIControls. See symbol.rb for the uicontrolevent
5
9
  # constant aliases.
6
10
  #
@@ -1,5 +1,9 @@
1
1
  class UITextView
2
2
 
3
+ sugarcube_cleanup do
4
+ self.off
5
+ end
6
+
3
7
  def sugarcube_callbacks
4
8
  @sugarcube_callbacks ||= Hash.new { |h,k| h[k] = [] }
5
9
  end
@@ -3,6 +3,10 @@
3
3
  # changing it to suit my needs, and offering it here
4
4
  class UIView
5
5
 
6
+ sugarcube_cleanup do
7
+ self.off_gestures
8
+ end
9
+
6
10
  # A generic gesture adder, but accepts a block like the other gesture methods
7
11
  # @yield [recognizer] Handles the gesture event, and passes the recognizer instance to the block.
8
12
  # @param options [Hash] method/value pairs to call on the gesture.
@@ -0,0 +1,49 @@
1
+ class UIViewController
2
+
3
+ def sugarcube_cleanup
4
+ super
5
+ self.view.sugarcube_cleanup
6
+ self.childViewControllers.each do |subctlr|
7
+ subctlr.sugarcube_cleanup
8
+ end
9
+ end
10
+
11
+ end
12
+
13
+
14
+ class UIResponder
15
+
16
+ class << self
17
+
18
+ def sugarcube_cleanup(&block)
19
+ @sugarcube_cleanup ||= []
20
+ return @sugarcube_cleanup unless block
21
+ @sugarcube_cleanup << block
22
+ return nil
23
+ end
24
+
25
+ end
26
+
27
+ def sugarcube_cleanup
28
+ self.class.ancestors.each do |klass|
29
+ next unless klass.respond_to?(:sugarcube_cleanup)
30
+ klass.sugarcube_cleanup.each do |block|
31
+ self.instance_eval(&block)
32
+ end
33
+ break if klass == UIResponder
34
+ end
35
+ end
36
+
37
+ end
38
+
39
+
40
+ class UIView
41
+
42
+ def sugarcube_cleanup
43
+ super
44
+ self.subviews.each do |subview|
45
+ subview.sugarcube_cleanup
46
+ end
47
+ end
48
+
49
+ end
@@ -1,3 +1,3 @@
1
1
  module SugarCube
2
- Version = '1.3.2'
2
+ Version = '1.3.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sugarcube
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -190,6 +190,7 @@ files:
190
190
  - lib/sugarcube.rb
191
191
  - lib/sugarcube/adjust.rb
192
192
  - lib/sugarcube/look_in.rb
193
+ - lib/sugarcube/sugarcube_cleanup.rb
193
194
  - lib/sugarcube/version.rb
194
195
  - resources/Default-568h@2x.png
195
196
  - resources/Default.png