sugarcube 0.18.8 → 0.18.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -36,7 +36,8 @@ class NSString
36
36
  return self[1..-1].to_i(16).uicolor(alpha)
37
37
  end
38
38
 
39
- self.uiimage.uicolor(alpha)
39
+ img = self.uiimage
40
+ img && img.uicolor(alpha)
40
41
  end
41
42
 
42
43
  # @param font [UIFont] Optional, defaults to UIFont.systemFontOfSize(UIFont.systemFontSize)
@@ -1,3 +1,3 @@
1
1
  module SugarCube
2
- Version = '0.18.8'
2
+ Version = '0.18.9'
3
3
  end
@@ -34,18 +34,28 @@ describe "NSString" do
34
34
  font.pointSize.should == UIFont.systemFontSize
35
35
  end
36
36
 
37
- it "should have a #uicolor method" do
38
- color = '#ffffff'.uicolor
39
- UIColor.should === color
40
- color.red.should == 1.0
41
- color.green.should == 1.0
42
- color.blue.should == 1.0
37
+ describe "should have a #uicolor method" do
38
+ it "that supports hex" do
39
+ color = '#ffffff'.uicolor
40
+ UIColor.should === color
41
+ color.red.should == 1.0
42
+ color.green.should == 1.0
43
+ color.blue.should == 1.0
43
44
 
44
- color = '#808080'.uicolor
45
- UIColor.should === color
46
- ((color.red * 2).round / 2.0).should == 0.5
47
- ((color.green * 2).round / 2.0).should == 0.5
48
- ((color.blue * 2).round / 2.0).should == 0.5
45
+ color = '#808080'.uicolor
46
+ UIColor.should === color
47
+ ((color.red * 2).round / 2.0).should == 0.5
48
+ ((color.green * 2).round / 2.0).should == 0.5
49
+ ((color.blue * 2).round / 2.0).should == 0.5
50
+ end
51
+
52
+ it "that supports image names" do
53
+ 'little_square'.uicolor.should == 'little_square'.uiimage.uicolor
54
+ end
55
+
56
+ it "that supports non-existant image names" do
57
+ 'this is not my beautiful house!'.uicolor.should == nil
58
+ end
49
59
  end
50
60
 
51
61
  it "should have a #uilabel method" do
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.8
4
+ version: 0.18.9
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-19 00:00:00.000000000 Z
16
+ date: 2013-02-20 00:00:00.000000000 Z
17
17
  dependencies: []
18
18
  description: ! '== Description
19
19