sugarcube 0.19.2 → 0.19.4
Sign up to get free protection for your applications and to get access to all the features.
data/lib/sugarcube/nsdate.rb
CHANGED
@@ -3,7 +3,7 @@ class NSDate
|
|
3
3
|
# a string using string_with_format's templating, and strings are concatenated
|
4
4
|
# as-is
|
5
5
|
SugarCubeFormats = {
|
6
|
-
iso8601: [:yyyy, '-', :MM, '-', :dd, ' ', :HH
|
6
|
+
iso8601: [:yyyy, '-', :MM, '-', :dd, ' ', :'HH:mm:ss.SSS']
|
7
7
|
}
|
8
8
|
|
9
9
|
def self.from_components(components)
|
@@ -1,16 +1,14 @@
|
|
1
1
|
class UIColor
|
2
2
|
|
3
3
|
def to_s
|
4
|
+
alpha_s = ((alpha || 1) < 1 ? "(#{alpha})" : '')
|
4
5
|
system_color = system_name
|
5
|
-
return system_color if system_color
|
6
|
+
return "UIColor.#{system_color}#{alpha_s}" if system_color
|
6
7
|
|
7
|
-
|
8
|
+
alpha_s = ((alpha || 1) < 1 ? ", alpha: #{alpha}" : '')
|
9
|
+
inside = (css_name && ":#{css_name}") || (hex && "'#{hex}'")
|
8
10
|
if inside
|
9
|
-
|
10
|
-
return "UIColor.color(#{inside}, #{alpha})"
|
11
|
-
else
|
12
|
-
return "UIColor.color(#{inside})"
|
13
|
-
end
|
11
|
+
return "UIColor.color(#{inside}#{alpha_s})"
|
14
12
|
else
|
15
13
|
super
|
16
14
|
end
|
data/lib/sugarcube/uicolor.rb
CHANGED
@@ -120,13 +120,14 @@ class UIColor
|
|
120
120
|
|
121
121
|
def system_name
|
122
122
|
system_color = nil
|
123
|
+
without_alpha = self.uicolor(1)
|
123
124
|
Symbol.uicolors.each_pair do |color, method|
|
124
|
-
if UIColor.send(method) ==
|
125
|
+
if UIColor.send(method) == without_alpha
|
125
126
|
system_color = method
|
126
127
|
break
|
127
128
|
end
|
128
129
|
end
|
129
|
-
return system_color
|
130
|
+
return system_color
|
130
131
|
end
|
131
132
|
|
132
133
|
private
|
data/lib/sugarcube/uiimage.rb
CHANGED
@@ -321,8 +321,8 @@ class UIImage
|
|
321
321
|
def darken(options={})
|
322
322
|
filter_name = 'CIColorControls'
|
323
323
|
filter_options = {
|
324
|
-
inputBrightness: options[:brightness] ||
|
325
|
-
inputSaturation: options[:saturation] ||
|
324
|
+
inputBrightness: options[:brightness] || 0,
|
325
|
+
inputSaturation: options[:saturation] || 0,
|
326
326
|
}
|
327
327
|
|
328
328
|
cg_input_image = CIImage.alloc.initWithImage(self)
|
data/lib/sugarcube/version.rb
CHANGED
@@ -16,8 +16,8 @@ describe 'UIColor (CSS)' do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should have a #system_name method" do
|
19
|
-
UIColor.whiteColor.system_name.should ==
|
20
|
-
UIColor.blackColor.system_name.should ==
|
19
|
+
UIColor.whiteColor.system_name.should == :whiteColor
|
20
|
+
UIColor.blackColor.system_name.should == :blackColor
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should return css color names" do
|
@@ -34,6 +34,15 @@ describe 'UIColor (CSS)' do
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
+
it "should have good to_s return values" do
|
38
|
+
UIColor.whiteColor.to_s.should == 'UIColor.whiteColor'
|
39
|
+
UIColor.whiteColor.uicolor(0.5).to_s.should == 'UIColor.whiteColor(0.5)'
|
40
|
+
:indianred.uicolor.to_s.should == 'UIColor.color(:indianred)'
|
41
|
+
:indianred.uicolor(0.5).to_s.should == 'UIColor.color(:indianred, alpha: 0.5)'
|
42
|
+
'#12be3f'.uicolor.to_s.should == "UIColor.color('#12be3f')"
|
43
|
+
'#12be3f'.uicolor(0.5).to_s.should == "UIColor.color('#12be3f', alpha: 0.5)"
|
44
|
+
end
|
45
|
+
|
37
46
|
it "should return UIColor objects" do
|
38
47
|
Symbol.uicolors.each do |name, method|
|
39
48
|
name.uicolor.should == UIColor.send(method)
|
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.19.
|
4
|
+
version: 0.19.4
|
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-03-
|
16
|
+
date: 2013-03-20 00:00:00.000000000 Z
|
17
17
|
dependencies: []
|
18
18
|
description: ! '== Description
|
19
19
|
|
@@ -89,6 +89,7 @@ files:
|
|
89
89
|
- lib/sugarcube/to_s/nserror.rb
|
90
90
|
- lib/sugarcube/to_s/nslayoutconstraint.rb
|
91
91
|
- lib/sugarcube/to_s/nsset.rb
|
92
|
+
- lib/sugarcube/to_s/nsurl.rb
|
92
93
|
- lib/sugarcube/to_s/uicolor.rb
|
93
94
|
- lib/sugarcube/to_s/uievent.rb
|
94
95
|
- lib/sugarcube/to_s/uilabel.rb
|