sugarcube 0.18.9 → 0.18.10
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +41 -2
- data/lib/sugarcube/numeric.rb +8 -0
- data/lib/sugarcube/symbol.rb +14 -3
- data/lib/sugarcube/timer.rb +32 -0
- data/lib/sugarcube/uibarbuttonitem.rb +128 -0
- data/lib/sugarcube/version.rb +1 -1
- data/spec/numeric_spec.rb +13 -0
- data/spec/timer_spec.rb +121 -0
- data/spec/uibarbuttonitem_spec.rb +195 -0
- metadata +7 -2
data/README.md
CHANGED
@@ -986,10 +986,49 @@ text_view.on :editing_did_end do
|
|
986
986
|
end
|
987
987
|
|
988
988
|
# later... like in `viewWillDisappear`. I'll use the alternative aliases here
|
989
|
-
text_view.off :change, :end, :begin
|
989
|
+
text_view.off :change, :end, :begin
|
990
990
|
```
|
991
991
|
|
992
|
-
|
992
|
+
UIBarButtonItem
|
993
|
+
----------------------
|
994
|
+
|
995
|
+
```ruby
|
996
|
+
UIBarButtonItem.done {
|
997
|
+
self.dismissViewControllerAnimated true, completion:nil
|
998
|
+
}
|
999
|
+
# =>
|
1000
|
+
UIBarButtonitem.alloc.initWithBarButtonSystemItem(:done.uibarbuttonitem, target:self, action:"action:")
|
1001
|
+
def action:sender
|
1002
|
+
self.dismissViewControllerAnimated true, completion:nil
|
1003
|
+
end
|
1004
|
+
|
1005
|
+
UIBarButtonitem.done(&action) => UIBarButtonitem.alloc.initWithBarButtonSystemItem(:done.uibarbuttonitem, target:self, action:"action:")
|
1006
|
+
UIBarButtonitem.cancel(&action) => UIBarButtonitem.alloc.initWithBarButtonSystemItem(:cancel.uibarbuttonitem, target:self, action:"action:")
|
1007
|
+
UIBarButtonitem.edit(&action) => UIBarButtonitem.alloc.initWithBarButtonSystemItem(:edit.uibarbuttonitem, target:self, action:"action:")
|
1008
|
+
UIBarButtonitem.save(&action) => UIBarButtonitem.alloc.initWithBarButtonSystemItem(:save.uibarbuttonitem, target:self, action:"action:")
|
1009
|
+
UIBarButtonitem.add(&action) => UIBarButtonitem.alloc.initWithBarButtonSystemItem(:add.uibarbuttonitem, target:self, action:"action:")
|
1010
|
+
UIBarButtonitem.flexiblespace(&action) => UIBarButtonitem.alloc.initWithBarButtonSystemItem(:flexiblespace.uibarbuttonitem, target:self, action:"action:")
|
1011
|
+
UIBarButtonitem.fixedspace(&action) => UIBarButtonitem.alloc.initWithBarButtonSystemItem(:fixedspace.uibarbuttonitem, target:self, action:"action:")
|
1012
|
+
UIBarButtonitem.compose(&action) => UIBarButtonitem.alloc.initWithBarButtonSystemItem(:compose.uibarbuttonitem, target:self, action:"action:")
|
1013
|
+
UIBarButtonitem.reply(&action) => UIBarButtonitem.alloc.initWithBarButtonSystemItem(:reply.uibarbuttonitem, target:self, action:"action:")
|
1014
|
+
UIBarButtonitem.action(&action) => UIBarButtonitem.alloc.initWithBarButtonSystemItem(:action.uibarbuttonitem, target:self, action:"action:")
|
1015
|
+
UIBarButtonitem.organize(&action) => UIBarButtonitem.alloc.initWithBarButtonSystemItem(:organize.uibarbuttonitem, target:self, action:"action:")
|
1016
|
+
UIBarButtonitem.bookmarks(&action) => UIBarButtonitem.alloc.initWithBarButtonSystemItem(:bookmarks.uibarbuttonitem, target:self, action:"action:")
|
1017
|
+
UIBarButtonitem.search(&action) => UIBarButtonitem.alloc.initWithBarButtonSystemItem(:search.uibarbuttonitem, target:self, action:"action:")
|
1018
|
+
UIBarButtonitem.refresh(&action) => UIBarButtonitem.alloc.initWithBarButtonSystemItem(:refresh.uibarbuttonitem, target:self, action:"action:")
|
1019
|
+
UIBarButtonitem.stop(&action) => UIBarButtonitem.alloc.initWithBarButtonSystemItem(:stop.uibarbuttonitem, target:self, action:"action:")
|
1020
|
+
UIBarButtonitem.camera(&action) => UIBarButtonitem.alloc.initWithBarButtonSystemItem(:camera.uibarbuttonitem, target:self, action:"action:")
|
1021
|
+
UIBarButtonitem.trash(&action) => UIBarButtonitem.alloc.initWithBarButtonSystemItem(:trash.uibarbuttonitem, target:self, action:"action:")
|
1022
|
+
UIBarButtonitem.play(&action) => UIBarButtonitem.alloc.initWithBarButtonSystemItem(:play.uibarbuttonitem, target:self, action:"action:")
|
1023
|
+
UIBarButtonitem.pause(&action) => UIBarButtonitem.alloc.initWithBarButtonSystemItem(:pause.uibarbuttonitem, target:self, action:"action:")
|
1024
|
+
UIBarButtonitem.rewind(&action) => UIBarButtonitem.alloc.initWithBarButtonSystemItem(:rewind.uibarbuttonitem, target:self, action:"action:")
|
1025
|
+
UIBarButtonitem.fastforward(&action) => UIBarButtonitem.alloc.initWithBarButtonSystemItem(:fastforward.uibarbuttonitem, target:self, action:"action:")
|
1026
|
+
UIBarButtonitem.undo(&action) => UIBarButtonitem.alloc.initWithBarButtonSystemItem(:undo.uibarbuttonitem, target:self, action:"action:")
|
1027
|
+
UIBarButtonitem.redo(&action) => UIBarButtonitem.alloc.initWithBarButtonSystemItem(:redo.uibarbuttonitem, target:self, action:"action:")
|
1028
|
+
UIBarButtonitem.pagecurl(&action) => UIBarButtonitem.alloc.initWithBarButtonSystemItem(:pagecurl.uibarbuttonitem, target:self, action:"action:")
|
1029
|
+
```
|
1030
|
+
|
1031
|
+
NSNotificationCenter
|
993
1032
|
----------------------
|
994
1033
|
|
995
1034
|
Makes it easy to post a notification to some or all objects.
|
data/lib/sugarcube/numeric.rb
CHANGED
@@ -9,11 +9,19 @@ class Numeric
|
|
9
9
|
end
|
10
10
|
alias radian radians
|
11
11
|
|
12
|
+
def in_radians
|
13
|
+
self
|
14
|
+
end
|
15
|
+
|
12
16
|
def degrees
|
13
17
|
self / 180.0 * Math::PI
|
14
18
|
end
|
15
19
|
alias degree degrees
|
16
20
|
|
21
|
+
def in_degrees
|
22
|
+
self * 180.0 / Math::PI
|
23
|
+
end
|
24
|
+
|
17
25
|
def pi
|
18
26
|
self * Math::PI
|
19
27
|
end
|
data/lib/sugarcube/symbol.rb
CHANGED
@@ -32,7 +32,8 @@ class Symbol
|
|
32
32
|
attr_accessor :returnkeys
|
33
33
|
attr_accessor :statusbar_styles
|
34
34
|
attr_accessor :barmetrics
|
35
|
-
attr_accessor :
|
35
|
+
attr_accessor :barbuttonitems
|
36
|
+
attr_accessor :barbuttonstyles
|
36
37
|
attr_accessor :keyboardtypes
|
37
38
|
attr_accessor :autoresizemasks
|
38
39
|
|
@@ -356,7 +357,7 @@ class Symbol
|
|
356
357
|
landscape: UIBarMetricsLandscapePhone,
|
357
358
|
}
|
358
359
|
|
359
|
-
@
|
360
|
+
@barbuttonitems = {
|
360
361
|
done: UIBarButtonSystemItemDone,
|
361
362
|
cancel: UIBarButtonSystemItemCancel,
|
362
363
|
edit: UIBarButtonSystemItemEdit,
|
@@ -383,6 +384,12 @@ class Symbol
|
|
383
384
|
pagecurl: UIBarButtonSystemItemPageCurl,
|
384
385
|
}
|
385
386
|
|
387
|
+
@barbuttonstyles = {
|
388
|
+
plain: UIBarButtonItemStylePlain,
|
389
|
+
bordered: UIBarButtonItemStyleBordered,
|
390
|
+
done: UIBarButtonItemStyleDone
|
391
|
+
}
|
392
|
+
|
386
393
|
@keyboardtypes = {
|
387
394
|
default: UIKeyboardTypeDefault,
|
388
395
|
asciicapable: UIKeyboardTypeASCIICapable,
|
@@ -616,7 +623,11 @@ class Symbol
|
|
616
623
|
end
|
617
624
|
|
618
625
|
def uibarbuttonitem
|
619
|
-
look_in(Symbol.
|
626
|
+
look_in(Symbol.barbuttonitems)
|
627
|
+
end
|
628
|
+
|
629
|
+
def uibarbuttonstyle
|
630
|
+
look_in(Symbol.barbuttonstyles)
|
620
631
|
end
|
621
632
|
|
622
633
|
def uikeyboardtype
|
data/lib/sugarcube/timer.rb
CHANGED
@@ -6,6 +6,10 @@ class Numeric
|
|
6
6
|
alias millisecs milliseconds
|
7
7
|
alias millisec milliseconds
|
8
8
|
|
9
|
+
def in_milliseconds
|
10
|
+
self * 1000
|
11
|
+
end
|
12
|
+
|
9
13
|
def seconds
|
10
14
|
self
|
11
15
|
end
|
@@ -13,6 +17,10 @@ class Numeric
|
|
13
17
|
alias sec seconds
|
14
18
|
alias secs seconds
|
15
19
|
|
20
|
+
def in_seconds
|
21
|
+
self
|
22
|
+
end
|
23
|
+
|
16
24
|
def minutes
|
17
25
|
self * 60
|
18
26
|
end
|
@@ -20,31 +28,55 @@ class Numeric
|
|
20
28
|
alias min minutes
|
21
29
|
alias mins minutes
|
22
30
|
|
31
|
+
def in_minutes
|
32
|
+
self / 1.minute.to_f
|
33
|
+
end
|
34
|
+
|
23
35
|
def hours
|
24
36
|
self * 3600
|
25
37
|
end
|
26
38
|
alias hour hours
|
27
39
|
|
40
|
+
def in_hours
|
41
|
+
self / 1.hour.to_f
|
42
|
+
end
|
43
|
+
|
28
44
|
def days
|
29
45
|
self.hours * 24
|
30
46
|
end
|
31
47
|
alias day days
|
32
48
|
|
49
|
+
def in_days
|
50
|
+
self / 1.day.to_f
|
51
|
+
end
|
52
|
+
|
33
53
|
def weeks
|
34
54
|
self.days * 7
|
35
55
|
end
|
36
56
|
alias week weeks
|
37
57
|
|
58
|
+
def in_weeks
|
59
|
+
self / 1.week.to_f
|
60
|
+
end
|
61
|
+
|
38
62
|
def months
|
39
63
|
self.days * 30
|
40
64
|
end
|
41
65
|
alias month months
|
42
66
|
|
67
|
+
def in_months
|
68
|
+
self / 1.month.to_f
|
69
|
+
end
|
70
|
+
|
43
71
|
def years
|
44
72
|
self.days * 365
|
45
73
|
end
|
46
74
|
alias year years
|
47
75
|
|
76
|
+
def in_years
|
77
|
+
self / 1.year.to_f
|
78
|
+
end
|
79
|
+
|
48
80
|
def later(user_info=nil, &fire)
|
49
81
|
NSTimer.scheduledTimerWithTimeInterval(self, target: fire, selector: 'call:', userInfo: user_info, repeats: false)
|
50
82
|
end
|
@@ -0,0 +1,128 @@
|
|
1
|
+
class UIBarButtonItem
|
2
|
+
|
3
|
+
class << self
|
4
|
+
|
5
|
+
def done(&action)
|
6
|
+
sugarcube_barbuttonitem :done.uibarbuttonitem, action
|
7
|
+
end
|
8
|
+
|
9
|
+
def cancel(&action)
|
10
|
+
sugarcube_barbuttonitem :cancel.uibarbuttonitem, action
|
11
|
+
end
|
12
|
+
|
13
|
+
def edit(&action)
|
14
|
+
sugarcube_barbuttonitem :edit.uibarbuttonitem, action
|
15
|
+
end
|
16
|
+
|
17
|
+
def save(&action)
|
18
|
+
sugarcube_barbuttonitem :save.uibarbuttonitem, action
|
19
|
+
end
|
20
|
+
|
21
|
+
def add(&action)
|
22
|
+
sugarcube_barbuttonitem :add.uibarbuttonitem, action
|
23
|
+
end
|
24
|
+
|
25
|
+
def flexiblespace(&action)
|
26
|
+
sugarcube_barbuttonitem :flexiblespace.uibarbuttonitem, action
|
27
|
+
end
|
28
|
+
|
29
|
+
def fixedspace(&action)
|
30
|
+
sugarcube_barbuttonitem :fixedspace.uibarbuttonitem, action
|
31
|
+
end
|
32
|
+
|
33
|
+
def compose(&action)
|
34
|
+
sugarcube_barbuttonitem :compose.uibarbuttonitem, action
|
35
|
+
end
|
36
|
+
|
37
|
+
def reply(&action)
|
38
|
+
sugarcube_barbuttonitem :reply.uibarbuttonitem, action
|
39
|
+
end
|
40
|
+
|
41
|
+
def action(&action)
|
42
|
+
sugarcube_barbuttonitem :action.uibarbuttonitem, action
|
43
|
+
end
|
44
|
+
|
45
|
+
def organize(&action)
|
46
|
+
sugarcube_barbuttonitem :organize.uibarbuttonitem, action
|
47
|
+
end
|
48
|
+
|
49
|
+
def bookmarks(&action)
|
50
|
+
sugarcube_barbuttonitem :bookmarks.uibarbuttonitem, action
|
51
|
+
end
|
52
|
+
|
53
|
+
def search(&action)
|
54
|
+
sugarcube_barbuttonitem :search.uibarbuttonitem, action
|
55
|
+
end
|
56
|
+
|
57
|
+
def refresh(&action)
|
58
|
+
sugarcube_barbuttonitem :refresh.uibarbuttonitem, action
|
59
|
+
end
|
60
|
+
|
61
|
+
def stop(&action)
|
62
|
+
sugarcube_barbuttonitem :stop.uibarbuttonitem, action
|
63
|
+
end
|
64
|
+
|
65
|
+
def camera(&action)
|
66
|
+
sugarcube_barbuttonitem :camera.uibarbuttonitem, action
|
67
|
+
end
|
68
|
+
|
69
|
+
def trash(&action)
|
70
|
+
sugarcube_barbuttonitem :trash.uibarbuttonitem, action
|
71
|
+
end
|
72
|
+
|
73
|
+
def play(&action)
|
74
|
+
sugarcube_barbuttonitem :play.uibarbuttonitem, action
|
75
|
+
end
|
76
|
+
|
77
|
+
def pause(&action)
|
78
|
+
sugarcube_barbuttonitem :pause.uibarbuttonitem, action
|
79
|
+
end
|
80
|
+
|
81
|
+
def rewind(&action)
|
82
|
+
sugarcube_barbuttonitem :rewind.uibarbuttonitem, action
|
83
|
+
end
|
84
|
+
|
85
|
+
def fastforward(&action)
|
86
|
+
sugarcube_barbuttonitem :fastforward.uibarbuttonitem, action
|
87
|
+
end
|
88
|
+
|
89
|
+
def undo(&action)
|
90
|
+
sugarcube_barbuttonitem :undo.uibarbuttonitem, action
|
91
|
+
end
|
92
|
+
|
93
|
+
def redo(&action)
|
94
|
+
sugarcube_barbuttonitem :redo.uibarbuttonitem, action
|
95
|
+
end
|
96
|
+
|
97
|
+
def pagecurl(&action)
|
98
|
+
sugarcube_barbuttonitem :pagecurl.uibarbuttonitem, action
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
102
|
+
|
103
|
+
# Adds the action and keeps a strong reference to the Proc object.
|
104
|
+
def set_target_and_action target, action
|
105
|
+
self.target = target
|
106
|
+
self.action = 'sugarcube_handle_action:'
|
107
|
+
@sugarcube_action = action
|
108
|
+
end
|
109
|
+
|
110
|
+
|
111
|
+
private
|
112
|
+
|
113
|
+
def self.sugarcube_barbuttonitem(systemitem, action)
|
114
|
+
b = UIBarButtonItem.alloc.initWithBarButtonSystemItem systemitem, target:nil, action:nil
|
115
|
+
b.set_target_and_action b, action
|
116
|
+
b
|
117
|
+
end
|
118
|
+
|
119
|
+
def sugarcube_handle_action(sender)
|
120
|
+
handler = @sugarcube_action
|
121
|
+
if handler.arity == 0
|
122
|
+
handler.call
|
123
|
+
else
|
124
|
+
handler.call(sender)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
end
|
data/lib/sugarcube/version.rb
CHANGED
data/spec/numeric_spec.rb
CHANGED
@@ -13,6 +13,12 @@ describe "Numeric" do
|
|
13
13
|
1.5.radians.should == 1.5
|
14
14
|
end
|
15
15
|
|
16
|
+
it "should have a #in_radians method" do
|
17
|
+
0.radians.in_radians.should == 0
|
18
|
+
1.radian.in_radians.should == 1
|
19
|
+
1.5.radians.in_radians.should == 1.5
|
20
|
+
end
|
21
|
+
|
16
22
|
it "should have a #degree(s) method" do
|
17
23
|
0.degrees.should == 0
|
18
24
|
1.degree.should == Math::PI / 180
|
@@ -20,6 +26,13 @@ describe "Numeric" do
|
|
20
26
|
45.degrees.should == Math::PI / 4
|
21
27
|
end
|
22
28
|
|
29
|
+
it "should have a #degree(s) method" do
|
30
|
+
0.degrees.should == 0
|
31
|
+
1.degree.in_degrees.round.should == 1
|
32
|
+
180.degrees.in_degrees.round.should == 180
|
33
|
+
45.degrees.in_degrees.round.should == 45
|
34
|
+
end
|
35
|
+
|
23
36
|
it "should have a #pi method" do
|
24
37
|
0.pi.should == 0
|
25
38
|
1.pi.should == Math::PI
|
data/spec/timer_spec.rb
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
describe "Numeric Timer methods" do
|
2
|
+
|
3
|
+
it "should have a #millisecond(s) method" do
|
4
|
+
0.milliseconds.should == 0
|
5
|
+
500.millisecond.should == 0.5
|
6
|
+
1000.milliseconds.should == 1
|
7
|
+
2000.milliseconds.should == 2.0
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should have an #in_milliseconds method" do
|
11
|
+
0.milliseconds.in_milliseconds.should == 0
|
12
|
+
500.millisecond.in_milliseconds.should == 500
|
13
|
+
2000.milliseconds.in_milliseconds.should == 2000
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should have a #second(s) method" do
|
17
|
+
0.seconds.should == 0
|
18
|
+
1.second.should == 1
|
19
|
+
2.seconds.should == 2
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should have an #in_seconds method" do
|
23
|
+
0.seconds.in_seconds.should == 0
|
24
|
+
1.second.in_seconds.should == 1
|
25
|
+
2.seconds.in_seconds.should == 2
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should have a #minute(s) method" do
|
29
|
+
0.minutes.should == 0
|
30
|
+
1.minute.should == 60.seconds
|
31
|
+
2.minutes.should == 120.seconds
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should have an #in_minutes method" do
|
35
|
+
0.minutes.in_minutes.should == 0
|
36
|
+
1.minute.in_minutes.should == 1
|
37
|
+
2.minutes.in_minutes.should == 2
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should have a #hour(s) method" do
|
41
|
+
0.hours.should == 0
|
42
|
+
1.hour.should == 60.minutes
|
43
|
+
2.hours.should == 120.minutes
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should have an #in_hours method" do
|
47
|
+
0.hours.in_hours.should == 0
|
48
|
+
1.hour.in_hours.should == 1
|
49
|
+
2.hours.in_hours.should == 2
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should have a #day(s) method" do
|
53
|
+
0.days.should == 0
|
54
|
+
1.day.should == 24.hours
|
55
|
+
2.days.should == 48.hour
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should have an #in_days method" do
|
59
|
+
0.days.in_days.should == 0
|
60
|
+
1.day.in_days.should == 1
|
61
|
+
2.days.in_days.should == 2
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should have a #week(s) method" do
|
65
|
+
0.weeks.should == 0
|
66
|
+
1.week.should == 7.days
|
67
|
+
2.weeks.should == 14.days
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should have an #in_weeks method" do
|
71
|
+
0.weeks.in_weeks.should == 0
|
72
|
+
1.week.in_weeks.should == 1
|
73
|
+
2.weeks.in_weeks.should == 2
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should have a #month(s) method" do
|
77
|
+
0.months.should == 0
|
78
|
+
1.month.should == 30.days
|
79
|
+
2.months.should == 60.days
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should have an #in_months method" do
|
83
|
+
0.months.in_months.should == 0
|
84
|
+
1.month.in_months.should == 1
|
85
|
+
2.months.in_months.should == 2
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should have a #year(s) method" do
|
89
|
+
0.years.should == 0
|
90
|
+
1.year.should == 365.days
|
91
|
+
2.years.should == 730.days
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should have an #in_years method" do
|
95
|
+
0.years.in_years.should == 0
|
96
|
+
1.year.in_years.should == 1
|
97
|
+
2.years.in_years.should == 2
|
98
|
+
end
|
99
|
+
|
100
|
+
it "should have a #later method" do
|
101
|
+
@later = nil
|
102
|
+
0.9.seconds.later do
|
103
|
+
@later = true
|
104
|
+
end
|
105
|
+
wait 1 {
|
106
|
+
@later.should == true
|
107
|
+
}
|
108
|
+
end
|
109
|
+
|
110
|
+
it "should have a #every method" do
|
111
|
+
@every = 0
|
112
|
+
@stop_me = 480.milliseconds.every do
|
113
|
+
@every += 1
|
114
|
+
end
|
115
|
+
wait 1 {
|
116
|
+
@every.should == 2
|
117
|
+
@stop_me.invalidate
|
118
|
+
}
|
119
|
+
end
|
120
|
+
|
121
|
+
end
|
@@ -0,0 +1,195 @@
|
|
1
|
+
describe UIBarButtonItem do
|
2
|
+
|
3
|
+
it 'should be :done' do
|
4
|
+
b = UIBarButtonItem.done {
|
5
|
+
@result = :done
|
6
|
+
}
|
7
|
+
b.target.send b.action, b
|
8
|
+
@result.should == :done
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should be :cancel' do
|
12
|
+
b = UIBarButtonItem.cancel {
|
13
|
+
@result = :cancel
|
14
|
+
}
|
15
|
+
b.target.send b.action, b
|
16
|
+
@result.should == :cancel
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should be :edit' do
|
20
|
+
b = UIBarButtonItem.edit {
|
21
|
+
@result = :edit
|
22
|
+
}
|
23
|
+
b.target.send b.action, b
|
24
|
+
@result.should == :edit
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should be :save' do
|
28
|
+
b = UIBarButtonItem.save {
|
29
|
+
@result = :save
|
30
|
+
}
|
31
|
+
b.target.send b.action, b
|
32
|
+
@result.should == :save
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should be :add' do
|
36
|
+
b = UIBarButtonItem.add {
|
37
|
+
@result = :add
|
38
|
+
}
|
39
|
+
b.target.send b.action, b
|
40
|
+
@result.should == :add
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'should be :flexiblespace' do
|
44
|
+
b = UIBarButtonItem.flexiblespace {
|
45
|
+
@result = :flexiblespace
|
46
|
+
}
|
47
|
+
b.target.send b.action, b
|
48
|
+
@result.should == :flexiblespace
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'should be :fixedspace' do
|
52
|
+
b = UIBarButtonItem.fixedspace {
|
53
|
+
@result = :fixedspace
|
54
|
+
}
|
55
|
+
b.target.send b.action, b
|
56
|
+
@result.should == :fixedspace
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'should be :compose' do
|
60
|
+
b = UIBarButtonItem.compose {
|
61
|
+
@result = :compose
|
62
|
+
}
|
63
|
+
b.target.send b.action, b
|
64
|
+
@result.should == :compose
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'should be :reply' do
|
68
|
+
b = UIBarButtonItem.reply {
|
69
|
+
@result = :reply
|
70
|
+
}
|
71
|
+
b.target.send b.action, b
|
72
|
+
@result.should == :reply
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'should be :action' do
|
76
|
+
b = UIBarButtonItem.action {
|
77
|
+
@result = :action
|
78
|
+
}
|
79
|
+
b.target.send b.action, b
|
80
|
+
@result.should == :action
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'should be :organize' do
|
84
|
+
b = UIBarButtonItem.organize {
|
85
|
+
@result = :organize
|
86
|
+
}
|
87
|
+
b.target.send b.action, b
|
88
|
+
@result.should == :organize
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'should be :bookmarks' do
|
92
|
+
b = UIBarButtonItem.bookmarks {
|
93
|
+
@result = :bookmarks
|
94
|
+
}
|
95
|
+
b.target.send b.action, b
|
96
|
+
@result.should == :bookmarks
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'should be :search' do
|
100
|
+
b = UIBarButtonItem.search {
|
101
|
+
@result = :search
|
102
|
+
}
|
103
|
+
b.target.send b.action, b
|
104
|
+
@result.should == :search
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'should be :refresh' do
|
108
|
+
b = UIBarButtonItem.refresh {
|
109
|
+
@result = :refresh
|
110
|
+
}
|
111
|
+
b.target.send b.action, b
|
112
|
+
@result.should == :refresh
|
113
|
+
end
|
114
|
+
|
115
|
+
it 'should be :stop' do
|
116
|
+
b = UIBarButtonItem.stop {
|
117
|
+
@result = :stop
|
118
|
+
}
|
119
|
+
b.target.send b.action, b
|
120
|
+
@result.should == :stop
|
121
|
+
end
|
122
|
+
|
123
|
+
it 'should be :camera' do
|
124
|
+
b = UIBarButtonItem.camera {
|
125
|
+
@result = :camera
|
126
|
+
}
|
127
|
+
b.target.send b.action, b
|
128
|
+
@result.should == :camera
|
129
|
+
end
|
130
|
+
|
131
|
+
it 'should be :trash' do
|
132
|
+
b = UIBarButtonItem.trash {
|
133
|
+
@result = :trash
|
134
|
+
}
|
135
|
+
b.target.send b.action, b
|
136
|
+
@result.should == :trash
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'should be :play' do
|
140
|
+
b = UIBarButtonItem.play {
|
141
|
+
@result = :play
|
142
|
+
}
|
143
|
+
b.target.send b.action, b
|
144
|
+
@result.should == :play
|
145
|
+
end
|
146
|
+
|
147
|
+
it 'should be :pause' do
|
148
|
+
b = UIBarButtonItem.pause {
|
149
|
+
@result = :pause
|
150
|
+
}
|
151
|
+
b.target.send b.action, b
|
152
|
+
@result.should == :pause
|
153
|
+
end
|
154
|
+
|
155
|
+
it 'should be :rewind' do
|
156
|
+
b = UIBarButtonItem.rewind {
|
157
|
+
@result = :rewind
|
158
|
+
}
|
159
|
+
b.target.send b.action, b
|
160
|
+
@result.should == :rewind
|
161
|
+
end
|
162
|
+
|
163
|
+
it 'should be :fastforward' do
|
164
|
+
b = UIBarButtonItem.fastforward {
|
165
|
+
@result = :fastforward
|
166
|
+
}
|
167
|
+
b.target.send b.action, b
|
168
|
+
@result.should == :fastforward
|
169
|
+
end
|
170
|
+
|
171
|
+
it 'should be :undo' do
|
172
|
+
b = UIBarButtonItem.undo {
|
173
|
+
@result = :undo
|
174
|
+
}
|
175
|
+
b.target.send b.action, b
|
176
|
+
@result.should == :undo
|
177
|
+
end
|
178
|
+
|
179
|
+
it 'should be :redo' do
|
180
|
+
b = UIBarButtonItem.redo {
|
181
|
+
@result = :redo
|
182
|
+
}
|
183
|
+
b.target.send b.action, b
|
184
|
+
@result.should == :redo
|
185
|
+
end
|
186
|
+
|
187
|
+
it 'should be :pagecurl' do
|
188
|
+
b = UIBarButtonItem.pagecurl {
|
189
|
+
@result = :pagecurl
|
190
|
+
}
|
191
|
+
b.target.send b.action, b
|
192
|
+
@result.should == :pagecurl
|
193
|
+
end
|
194
|
+
|
195
|
+
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: 0.18.
|
4
|
+
version: 0.18.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2013-02-
|
16
|
+
date: 2013-02-22 00:00:00.000000000 Z
|
17
17
|
dependencies: []
|
18
18
|
description: ! '== Description
|
19
19
|
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- lib/sugarcube/uiactionsheet.rb
|
98
98
|
- lib/sugarcube/uiactivityindicator.rb
|
99
99
|
- lib/sugarcube/uialertview.rb
|
100
|
+
- lib/sugarcube/uibarbuttonitem.rb
|
100
101
|
- lib/sugarcube/uibutton.rb
|
101
102
|
- lib/sugarcube/uicolor.rb
|
102
103
|
- lib/sugarcube/uicontrol.rb
|
@@ -139,6 +140,8 @@ files:
|
|
139
140
|
- spec/nsurl_spec.rb
|
140
141
|
- spec/numeric_spec.rb
|
141
142
|
- spec/symbol_spec.rb
|
143
|
+
- spec/timer_spec.rb
|
144
|
+
- spec/uibarbuttonitem_spec.rb
|
142
145
|
- spec/uicolor_components_spec.rb
|
143
146
|
- spec/uicolor_css_spec.rb
|
144
147
|
- spec/uicolor_spec.rb
|
@@ -195,6 +198,8 @@ test_files:
|
|
195
198
|
- spec/nsurl_spec.rb
|
196
199
|
- spec/numeric_spec.rb
|
197
200
|
- spec/symbol_spec.rb
|
201
|
+
- spec/timer_spec.rb
|
202
|
+
- spec/uibarbuttonitem_spec.rb
|
198
203
|
- spec/uicolor_components_spec.rb
|
199
204
|
- spec/uicolor_css_spec.rb
|
200
205
|
- spec/uicolor_spec.rb
|