sugarcube 2.1.5 → 2.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5256d3a3604045e12947521df539e5754a12cc33
4
- data.tar.gz: 0cbd8ad1c7581e13c516233b9811e2b7fba89263
3
+ metadata.gz: 9ea660a3118fd4a7088293e17717ce63bcd5eace
4
+ data.tar.gz: 125596accb09c632e465ad0c6210ee85f277482f
5
5
  SHA512:
6
- metadata.gz: f221b267cc5051929001a992e5d15903a2ed0b3cc7b3ad9b2b65a73d1b42ea2521c622c256339f87a09a60879e9698f53a43fb8b0d8acb9577f29b25491700f8
7
- data.tar.gz: beb01c8e8958da6da010e6e3948aef9a4811245cad38a40aa304d3c52281d0c2e108901bfe8d7c39896c01407fe33118f9611e97cfcddc94386cf41c491f2955
6
+ metadata.gz: deb47f000d638c607df1cad4f716ba5d409c33aa79e9e431db534bf0a8dcc7bcf2ec16d05065ce4db09614a873a571d9dbbd16ed47f973022abcb6cb77e9f4a8
7
+ data.tar.gz: 70c071626397a53e0f2f5635c0add025c93731c3b2a815fb460c4b6d6091ec5e32e4cfad890f32369860a6e3859c98cc717f72e16e49923fe2c602fc9e8c21db
data/README.md CHANGED
@@ -708,6 +708,8 @@ Options:
708
708
  :show => Boolean - Whether to show the action sheet (default: true)
709
709
  :from => CGRect | UIBarButtonItem | UIToolbar | UITabBar | UIView (default: first window)
710
710
  Where to display the alert. Mostly relevant on iPad.
711
+ :view => UIView (default: first window)
712
+ The view to display the alert when used with :from => CGRect
711
713
 
712
714
  ```ruby
713
715
  # simple
@@ -119,7 +119,7 @@ class UIActionSheet
119
119
 
120
120
  case from
121
121
  when CGRect
122
- view = UIApplication.sharedApplication.windows[0]
122
+ view = options.fetch(:view, UIApplication.sharedApplication.windows[0])
123
123
  alert.showFromRect(from, inView: view, animated: true)
124
124
  when UIBarButtonItem
125
125
  alert.showFromBarButtonItem(from, animated: true)
@@ -84,7 +84,7 @@ class UIView
84
84
  # @overload on_swipe(options)
85
85
  # @option options [Fixnum] :fingers Number of fingers before gesture is recognized
86
86
  # @option options [Fixnum, Symbol] :direction Direction of swipe, as a UISwipeGestureRecognizerDirection constant or a symbol (`:left, :right, :up, :down`)
87
- def on_swipe(direction_or_options, &proc)
87
+ def on_swipe(direction_or_options=nil, &proc)
88
88
  direction = nil
89
89
  fingers = nil
90
90
 
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module SugarCube
2
- Version = '2.1.5'
2
+ Version = '2.2.0'
3
3
  end
@@ -61,6 +61,16 @@ describe UIActionSheet do
61
61
  alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false)
62
62
  end
63
63
 
64
+ it 'should have :from option that accepts CGRect and a :view that accepts UIView' do
65
+ view = UIView.alloc.initWithFrame(UIScreen.mainScreen.bounds)
66
+ window = UIApplication.sharedApplication.windows[0]
67
+ window << view
68
+ alert = UIActionSheet.alert('test', from: CGRect.new([0, 0], [320, 0]), view: view)
69
+ proper_wait 0.6
70
+ alert.visible?.should == true
71
+ alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false)
72
+ end
73
+
64
74
  it 'should have :from option that accepts UIBarButtonItem' do
65
75
  button = UIBarButtonItem.done
66
76
  toolbar = UIToolbar.alloc.initWithFrame(UIScreen.mainScreen.bounds)
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: 2.1.5
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Colin T.A. Gray
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-09-15 00:00:00.000000000 Z
14
+ date: 2014-09-17 00:00:00.000000000 Z
15
15
  dependencies: []
16
16
  description: |
17
17
  == Description