sugarcube 2.4.0 → 2.4.1

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: 972bf2ad876cf570e97d61fdc891d4d8b9da1e42
4
- data.tar.gz: 699b6b63231c98b2a8b4904b9a46d7632adf6e61
3
+ metadata.gz: c5199a43eb183b24f64f8dad92396624560961df
4
+ data.tar.gz: f933938827851ae363a5be7182db0193de43a4ce
5
5
  SHA512:
6
- metadata.gz: 93e69135801963c8c513797c7233171102c061bfa39dde8b91864121d3e5bd0dda2e50eb1cce54b69534609b69b294979379a054f436ce7e041323e32129654b
7
- data.tar.gz: bd648614288a354c55e1a8d7ace67c1ff5012f3f8a6584d5ef18255d90aab0bde31181b633fcfa52cc74a2e86e5be78230ba99903ca0c3e2bb1b8648708ae98c
6
+ metadata.gz: 273a39aa060c9bce9caa6df076a199655b24a993385e2512b8726d3289b67387a2d22973e0a9cf2325bde332413a16791ac0abeb824e82a6df3794e8d201f805
7
+ data.tar.gz: 4c81bdce9927a97b40a842b5a9576540db7dbc03e5ed194a177c98019e873237a6bf8bbaf88a34295906ec2e52cd66f06299e8153af4ae0d6d8fc4104d335b65
@@ -3,25 +3,9 @@ class UIColor
3
3
  def to_s
4
4
  return super unless self.respond_to?(:alpha)
5
5
 
6
- alpha_s = ((alpha || 1) < 1 ? "(#{alpha})" : '')
7
- system_color = system_name
8
- return "UIColor.#{system_color}#{alpha_s}" if system_color
9
-
10
- alpha_s = ((alpha || 1) < 1 ? ", alpha: #{alpha}" : '')
11
- inside = (css_name && ":#{css_name}") || (hex && "'#{hex}'")
12
- if inside
13
- return "UIColor.color(#{inside}#{alpha_s})"
14
- else
15
- super
16
- end
17
- end
18
-
19
- def inspect
20
- return super unless self.respond_to?(:alpha)
21
-
22
6
  alpha_s = ((alpha || 1) < 1 ? "(#{alpha})" : '')
23
7
  if system_name
24
- return "UIColor.#{system_name}#{alpha_s}"
8
+ return "UIColor.#{system_name}#{alpha_s.length > 0 ? '.colorWithAlphaComponent' + alpha_s : ''}"
25
9
  elsif css_name
26
10
  return ":#{css_name}.uicolor#{alpha_s}"
27
11
  elsif hex
@@ -2,8 +2,19 @@ class UIView
2
2
 
3
3
  def sugarcube_to_s(options={})
4
4
  suffix = ''
5
- suffix += " stylename: #{self.stylename.inspect}" if self.respond_to?(:stylename) && self.stylename
6
- suffix += " motion_kit_id: #{self.motion_kit_id.inspect}" if self.respond_to?(:motion_kit_id) && self.motion_kit_id
5
+ # teacup
6
+ if self.respond_to?(:stylename) && self.stylename && self.stylename.length > 0
7
+ suffix += " stylename: #{self.stylename.inspect}"
8
+ end
9
+ # motionkit
10
+ if self.respond_to?(:motion_kit_ids) && self.motion_kit_ids && self.motion_kit_ids.length > 0
11
+ if motion_kit_ids.length == 1
12
+ suffix += " motion_kit_id: #{self.motion_kit_id.inspect}"
13
+ else
14
+ suffix += " motion_kit_ids: #{self.motion_kit_ids.inspect}"
15
+ end
16
+ end
17
+ # rmq?
7
18
 
8
19
  if options[:inner].is_a? Hash
9
20
  inner = ''
@@ -3,29 +3,13 @@ class NSColor
3
3
  def to_s
4
4
  return super unless self.respond_to?(:alpha)
5
5
 
6
- alpha_s = ((alpha || 1) < 1 ? "(#{alpha})" : '')
7
- system_color = system_name
8
- return "NSColor.#{system_color}#{alpha_s}" if system_color
9
-
10
- alpha_s = ((alpha || 1) < 1 ? ", alpha: #{alpha}" : '')
11
- inside = (css_name && ":#{css_name}") || (hex && "'#{hex}'")
12
- if inside
13
- return "NSColor.color(#{inside}#{alpha_s})"
14
- else
15
- super
16
- end
17
- end
18
-
19
- def inspect
20
- return super unless self.respond_to?(:alpha)
21
-
22
6
  alpha_s = ((alpha || 1) < 1 ? "(#{alpha})" : '')
23
7
  if system_name
24
- return "NSColor.#{system_name}#{alpha_s}"
8
+ return "NSColor.#{system_name}#{alpha_s.length > 0 ? '.colorWithAlphaComponent' + alpha_s : ''}"
25
9
  elsif css_name
26
- return ":#{css_name}.uicolor#{alpha_s}"
10
+ return ":#{css_name}.nscolor#{alpha_s}"
27
11
  elsif hex
28
- return "'#{hex}'.uicolor#{alpha_s}"
12
+ return "'#{hex}'.nscolor#{alpha_s}"
29
13
  else
30
14
  super
31
15
  end
@@ -1,3 +1,3 @@
1
1
  module SugarCube
2
- Version = '2.4.0'
2
+ Version = '2.4.1'
3
3
  end
@@ -37,11 +37,11 @@ describe 'UIColor (CSS)' do
37
37
 
38
38
  it "should have good to_s return values" do
39
39
  UIColor.whiteColor.to_s.should == 'UIColor.whiteColor'
40
- UIColor.whiteColor.uicolor(0.5).to_s.should == 'UIColor.whiteColor(0.5)'
41
- :indianred.uicolor.to_s.should == 'UIColor.color(:indianred)'
42
- :indianred.uicolor(0.5).to_s.should == 'UIColor.color(:indianred, alpha: 0.5)'
43
- '#12be3f'.uicolor.to_s.should == "UIColor.color('#12be3f')"
44
- '#12be3f'.uicolor(0.5).to_s.should == "UIColor.color('#12be3f', alpha: 0.5)"
40
+ UIColor.whiteColor.uicolor(0.5).to_s.should == 'UIColor.whiteColor.colorWithAlphaComponent(0.5)'
41
+ :indianred.uicolor.to_s.should == ':indianred.uicolor'
42
+ :indianred.uicolor(0.5).to_s.should == ':indianred.uicolor(0.5)'
43
+ '#12be3f'.uicolor.to_s.should == "'#12be3f'.uicolor"
44
+ '#12be3f'.uicolor(0.5).to_s.should == "'#12be3f'.uicolor(0.5)"
45
45
  end
46
46
 
47
47
  it "should return UIColor objects" do
@@ -225,7 +225,10 @@ describe 'NSString UIColor extensions' do
225
225
  end
226
226
 
227
227
  it "that supports image names" do
228
- 'little_square'.uicolor.should == 'little_square'.uiimage.uicolor
228
+ a = 'little_square'.uicolor
229
+ b = 'little_square'.uiimage.uicolor
230
+ a.should.be.kind_of(UIColor)
231
+ b.should.be.kind_of(UIColor)
229
232
  end
230
233
 
231
234
  it "that supports non-existant image names" do
@@ -16,8 +16,12 @@ describe 'NSString' do
16
16
  end
17
17
 
18
18
  it "should have a #temporary_path method" do
19
- 'foo'.temporary_path.should.start_with?('/Users')
20
- 'foo'.temporary_path.should.end_with?('tmp/foo')
19
+ if 'foo'.temporary_path.start_with?('/Users')
20
+ 'foo'.temporary_path.should.start_with?('/Users')
21
+ else
22
+ 'foo'.temporary_path.should.start_with?('/var/folders')
23
+ end
24
+ 'foo'.temporary_path.should.end_with?('/foo')
21
25
  end
22
26
 
23
27
  it "should have a resource_path method" do
@@ -216,32 +220,27 @@ describe 'NSString deprecated methods' do
216
220
  end
217
221
 
218
222
  it "should have a #document method" do
219
- 'foo'.document.should.start_with?('/Users')
220
- 'foo'.document.should.end_with?('Documents/foo')
223
+ 'foo'.document.should == 'foo'.document_path.should
221
224
  end
222
225
 
223
226
  it "should have a #cache method" do
224
- 'foo'.cache.should.start_with?('/Users')
225
- 'foo'.cache.should.end_with?('Library/Caches/foo')
227
+ 'foo'.cache.should == 'foo'.cache_path
226
228
  end
227
229
 
228
230
  it "should have a #app_support method" do
229
- 'foo'.app_support.should.start_with?('/Users')
230
- 'foo'.app_support.should.end_with?('Library/Application Support/foo')
231
+ 'foo'.app_support.should == 'foo'.app_support_path
231
232
  end
232
233
 
233
234
  it "should have a #temporary method" do
234
- 'foo'.temporary.should.start_with?('/Users')
235
- 'foo'.temporary.should.end_with?('tmp/foo')
235
+ 'foo'.temporary.should == 'foo'.temporary_path
236
236
  end
237
237
 
238
238
  it "should have a resource method" do
239
- 'little_square.png'.resource.should.start_with?("/Users")
240
- 'little_square.png'.resource.should.end_with?("SugarCube_spec.app/little_square.png")
239
+ 'little_square.png'.resource.should == 'little_square.png'.resource_path
241
240
  end
242
241
 
243
242
  it "should have an #exists? method" do
244
- 'foo'.document_path.exists?.should == false
243
+ 'foo'.document_path.exists?.should == 'foo'.document_path.file_exists?
245
244
  end
246
245
 
247
246
  it "should have a remove! method" do
@@ -37,11 +37,11 @@ describe 'NSColor (CSS)' do
37
37
 
38
38
  it "should have good to_s return values" do
39
39
  NSColor.whiteColor.to_s.should == 'NSColor.whiteColor'
40
- NSColor.whiteColor.nscolor(0.5).to_s.should == 'NSColor.whiteColor(0.5)'
41
- :indianred.nscolor.to_s.should == 'NSColor.color(:indianred)'
42
- :indianred.nscolor(0.5).to_s.should == 'NSColor.color(:indianred, alpha: 0.5)'
43
- '#12be3f'.nscolor.to_s.should == "NSColor.color('#12be3f')"
44
- '#12be3f'.nscolor(0.5).to_s.should == "NSColor.color('#12be3f', alpha: 0.5)"
40
+ NSColor.whiteColor.nscolor(0.5).to_s.should == 'NSColor.whiteColor.colorWithAlphaComponent(0.5)'
41
+ :indianred.nscolor.to_s.should == ':indianred.nscolor'
42
+ :indianred.nscolor(0.5).to_s.should == ':indianred.nscolor(0.5)'
43
+ '#12be3f'.nscolor.to_s.should == "'#12be3f'.nscolor"
44
+ '#12be3f'.nscolor(0.5).to_s.should == "'#12be3f'.nscolor(0.5)"
45
45
  end
46
46
 
47
47
  Symbol.nscolors.each do |name, 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: 2.4.0
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Colin T.A. Gray