sugarcube 3.4.0 → 3.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c825347c6958710f5ee4933a8f1f0505b1c04df
4
- data.tar.gz: f92835087ed01e21e55609e2b91deba8a6f7b83f
3
+ metadata.gz: 8cafb2361552a041c24b9e363c89a977c51d0555
4
+ data.tar.gz: a5748317cfb7ddca118cd9f95d58e437e63147e9
5
5
  SHA512:
6
- metadata.gz: a20731556cd87e0a446650fac5e1d60528e7869f8a8d388e4e43610a33ea42f4e95a50af74a0f875d3e9995d40d7d5f6953347dab4770d78150b5cb35917be23
7
- data.tar.gz: a1ace56fcca4ac03c2d8d62ce56dc74640cd1120c180946b3f09b90c084847dfae3d6f8d42578d4f1d94a37d803dbc6c9380e3a3e2040c6e946abd1184d4cb6f
6
+ metadata.gz: 17ee322c4bc4c1d054db7ba41b4382f0de7d992aebe266e0101df4e79c17d8f3be97dcc2952779d96baa5ee1a56e3f0f56c2bc232084eb5f18c059afd7a8943e
7
+ data.tar.gz: fab4014b589e6399719a14c215c74b3980e19cb69be2c7edcdab7721e6fb6b14bbc73469ec5b2b206dc09378fb34066555b94b911476b19d0f9ad65c7135aebb
@@ -1,13 +1,17 @@
1
1
  class NSString
2
2
 
3
3
  # @return [NSURL]
4
- def nsurl
5
- @url ||= NSURL.alloc.initWithString(self)
4
+ def nsurl(baseURL=nil)
5
+ @url ||= begin
6
+ baseURL.nil? ? NSURL.alloc.initWithString(self) : NSURL.alloc.initWithString(self, relativeToURL: baseURL)
7
+ end
6
8
  end
7
9
 
8
10
  # @return [NSURL]
9
- def fileurl
10
- @fileurl ||= NSURL.fileURLWithPath(self)
11
+ def fileurl(baseURL=nil)
12
+ @fileurl ||= begin
13
+ baseURL.nil? ? NSURL.fileURLWithPath(self) : NSURL.fileURLWithPath(self, relativeToURL: baseURL)
14
+ end
11
15
  end
12
16
 
13
17
  def escape_url
@@ -4,11 +4,10 @@ module SugarCube
4
4
  def window(index=nil)
5
5
  if index
6
6
  UIApplication.sharedApplication.windows[index]
7
+ elsif UIApplication.sharedApplication.keyWindow
8
+ UIApplication.sharedApplication.keyWindow
7
9
  else
8
- (
9
- UIApplication.sharedApplication.keyWindow ||
10
- UIApplication.sharedApplication.windows[0]
11
- )
10
+ UIApplication.sharedApplication.windows.select { |window| window.subviews.count > 0 }.first
12
11
  end
13
12
  end
14
13
 
@@ -4,12 +4,14 @@ module SugarCube
4
4
  def window(index=nil)
5
5
  if index
6
6
  NSApplication.sharedApplication.windows[index]
7
+ elsif NSApplication.sharedApplication.keyWindow
8
+ NSApplication.sharedApplication.keyWindow
9
+ elsif NSApplication.sharedApplication.mainWindow
10
+ NSApplication.sharedApplication.mainWindow
7
11
  else
8
- (
9
- NSApplication.sharedApplication.keyWindow ||
10
- NSApplication.sharedApplication.mainWindow ||
11
- NSApplication.sharedApplication.windows[0]
12
- )
12
+ NSApplication.sharedApplication.windows.select { |window|
13
+ window.contentView != nil && window.contentView.subviews.count > 0
14
+ }.first
13
15
  end
14
16
  end
15
17
 
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module SugarCube
2
- Version = '3.4.0'
2
+ Version = '3.4.1'
3
3
  end
@@ -7,6 +7,13 @@ describe "NSString" do
7
7
  url.host.should == 'github.com'
8
8
  end
9
9
 
10
+ it "should have a #nsurl method with baseURL parametor" do
11
+ url = 'status'.nsurl('https://github.com'.nsurl)
12
+ url.should.be.kind_of(NSURL)
13
+ url.absoluteString.should == 'https://github.com/status'
14
+ url.host.should == 'github.com'
15
+ end
16
+
10
17
  it "should have a #nsdata method" do
11
18
  data = 'test'.nsdata
12
19
  data.should.be.kind_of(NSData)
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: 3.4.0
4
+ version: 3.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Colin T.A. Gray
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2016-07-27 00:00:00.000000000 Z
15
+ date: 2017-11-27 00:00:00.000000000 Z
16
16
  dependencies: []
17
17
  description: |
18
18
  == Description
@@ -304,7 +304,7 @@ files:
304
304
  - spec/osx/symbol_constants_spec.rb
305
305
  homepage: https://github.com/rubymotion/sugarcube
306
306
  licenses:
307
- - BSD
307
+ - MIT
308
308
  metadata: {}
309
309
  post_install_message:
310
310
  rdoc_options: []
@@ -322,88 +322,88 @@ required_rubygems_version: !ruby/object:Gem::Requirement
322
322
  version: '0'
323
323
  requirements: []
324
324
  rubyforge_project:
325
- rubygems_version: 2.4.5.1
325
+ rubygems_version: 2.5.2
326
326
  signing_key:
327
327
  specification_version: 4
328
328
  summary: Extensions for Ruby to make Rubymotion development more enjoyable, and hopefully
329
329
  more rubyesque!
330
330
  test_files:
331
- - spec/all/anonymous_spec.rb
331
+ - spec/osx/color_other_representations_spec.rb
332
+ - spec/osx/frameable_spec.rb
333
+ - spec/osx/symbol_constants_spec.rb
334
+ - spec/osx/color_spec.rb
335
+ - spec/osx/color_components_spec.rb
336
+ - spec/osx/base64_spec.rb
337
+ - spec/osx/nsview_spec.rb
338
+ - spec/osx/nsattributedstring_spec.rb
339
+ - spec/osx/spritekit_spec.rb
332
340
  - spec/all/numeric_spec.rb
333
- - spec/cocoa/base64_spec.rb
334
- - spec/cocoa/caanimation_spec.rb
335
- - spec/cocoa/calayer_spec.rb
336
- - spec/cocoa/nsarray_files_spec.rb
337
- - spec/cocoa/nsattributedstring_spec.rb
338
- - spec/cocoa/nscoder_spec.rb
339
- - spec/cocoa/nsdata_files_spec.rb
340
- - spec/cocoa/nsdictionary_files_spec.rb
341
- - spec/cocoa/nsindexpath_spec.rb
342
- - spec/cocoa/numeric_time_spec.rb
343
- - spec/cocoa/timer_spec.rb
344
- - spec/helpers/attributed_string.rb
345
- - spec/ios/568_spec.rb
346
- - spec/ios/animation_chain_spec.rb
347
- - spec/ios/base64_spec.rb
348
- - spec/ios/color_components_spec.rb
349
- - spec/ios/color_other_representations_spec.rb
350
- - spec/ios/color_spec.rb
351
- - spec/ios/core_graphics_spec.rb
352
- - spec/ios/core_location_spec.rb
353
- - spec/ios/date_parser_spec.rb
354
- - spec/ios/factories_spec.rb
355
- - spec/ios/fixnum_spec.rb
356
- - spec/ios/frameable_spec.rb
341
+ - spec/all/anonymous_spec.rb
342
+ - spec/ios/notification_spec.rb
357
343
  - spec/ios/gestures_spec.rb
358
- - spec/ios/image_cifilters_spec.rb
359
- - spec/ios/image_color_at_spec.rb
360
- - spec/ios/image_scale_spec.rb
344
+ - spec/ios/color_other_representations_spec.rb
345
+ - spec/ios/nsdate_upto_spec.rb
361
346
  - spec/ios/image_uiimage_filters_spec.rb
362
- - spec/ios/notification_spec.rb
363
- - spec/ios/nsarray_spec.rb
364
- - spec/ios/nsattributedstring_spec.rb
347
+ - spec/ios/uiwebview_spec.rb
348
+ - spec/ios/nsstring_files_spec.rb
349
+ - spec/ios/nsorderedset_spec.rb
365
350
  - spec/ios/nsdata_spec.rb
366
- - spec/ios/nsdate_delta_spec.rb
367
- - spec/ios/nsdate_spec.rb
368
- - spec/ios/nsdate_upto_spec.rb
351
+ - spec/ios/uiview_spec.rb
352
+ - spec/ios/uibarbuttonitem_spec.rb
353
+ - spec/ios/uiview_animation_tumble_spec.rb
354
+ - spec/ios/nsarray_spec.rb
355
+ - spec/ios/frameable_spec.rb
356
+ - spec/ios/core_location_spec.rb
357
+ - spec/ios/image_cifilters_spec.rb
358
+ - spec/ios/uicolor_spec.rb
369
359
  - spec/ios/nsindexpath_spec.rb
370
- - spec/ios/nsorderedset_spec.rb
371
- - spec/ios/nsset_spec.rb
372
- - spec/ios/nsstring_files_spec.rb
373
- - spec/ios/nsstring_spec.rb
374
- - spec/ios/nsstring_timezone_spec.rb
375
- - spec/ios/nsurl_spec.rb
376
- - spec/ios/numeric_spec.rb
377
- - spec/ios/pipes_spec.rb
378
- - spec/ios/spritekit_spec.rb
360
+ - spec/ios/uilabel_spec.rb
379
361
  - spec/ios/symbol_constants_spec.rb
380
- - spec/ios/symbol_uicolor_spec.rb
381
- - spec/ios/symbol_uifont_spec.rb
362
+ - spec/ios/nsstring_timezone_spec.rb
382
363
  - spec/ios/uiactionsheet_spec.rb
383
- - spec/ios/uialertcontroller_spec.rb
384
- - spec/ios/uialertview_spec.rb
385
- - spec/ios/uibarbuttonitem_spec.rb
386
- - spec/ios/uibutton_spec.rb
387
- - spec/ios/uicolor_spec.rb
364
+ - spec/ios/symbol_uicolor_spec.rb
365
+ - spec/ios/uiview_animation_spec.rb
366
+ - spec/ios/uiviewcontroller_spec.rb
367
+ - spec/ios/nsdate_delta_spec.rb
368
+ - spec/ios/nsset_spec.rb
388
369
  - spec/ios/uicontrol_spec.rb
389
- - spec/ios/uifont_spec.rb
370
+ - spec/ios/uialertview_spec.rb
371
+ - spec/ios/uitableviewcell_spec.rb
372
+ - spec/ios/nsstring_spec.rb
373
+ - spec/ios/image_scale_spec.rb
374
+ - spec/ios/color_spec.rb
390
375
  - spec/ios/uiimage_spec.rb
391
- - spec/ios/uilabel_spec.rb
376
+ - spec/ios/color_components_spec.rb
377
+ - spec/ios/fixnum_spec.rb
378
+ - spec/ios/uifont_spec.rb
379
+ - spec/ios/568_spec.rb
380
+ - spec/ios/animation_chain_spec.rb
381
+ - spec/ios/base64_spec.rb
382
+ - spec/ios/core_graphics_spec.rb
383
+ - spec/ios/unholy_spec.rb
384
+ - spec/ios/numeric_spec.rb
385
+ - spec/ios/uibutton_spec.rb
386
+ - spec/ios/nsurl_spec.rb
392
387
  - spec/ios/uitabbaritem_spec.rb
393
- - spec/ios/uitableviewcell_spec.rb
394
- - spec/ios/uiview_animation_spec.rb
395
- - spec/ios/uiview_animation_tumble_spec.rb
388
+ - spec/ios/factories_spec.rb
389
+ - spec/ios/symbol_uifont_spec.rb
390
+ - spec/ios/image_color_at_spec.rb
391
+ - spec/ios/pipes_spec.rb
396
392
  - spec/ios/uiview_attr_updates_spec.rb
397
- - spec/ios/uiview_spec.rb
398
- - spec/ios/uiviewcontroller_spec.rb
399
- - spec/ios/uiwebview_spec.rb
400
- - spec/ios/unholy_spec.rb
401
- - spec/osx/base64_spec.rb
402
- - spec/osx/color_components_spec.rb
403
- - spec/osx/color_other_representations_spec.rb
404
- - spec/osx/color_spec.rb
405
- - spec/osx/frameable_spec.rb
406
- - spec/osx/nsattributedstring_spec.rb
407
- - spec/osx/nsview_spec.rb
408
- - spec/osx/spritekit_spec.rb
409
- - spec/osx/symbol_constants_spec.rb
393
+ - spec/ios/nsattributedstring_spec.rb
394
+ - spec/ios/uialertcontroller_spec.rb
395
+ - spec/ios/date_parser_spec.rb
396
+ - spec/ios/spritekit_spec.rb
397
+ - spec/ios/nsdate_spec.rb
398
+ - spec/cocoa/nscoder_spec.rb
399
+ - spec/cocoa/numeric_time_spec.rb
400
+ - spec/cocoa/nsarray_files_spec.rb
401
+ - spec/cocoa/calayer_spec.rb
402
+ - spec/cocoa/nsindexpath_spec.rb
403
+ - spec/cocoa/nsdictionary_files_spec.rb
404
+ - spec/cocoa/caanimation_spec.rb
405
+ - spec/cocoa/nsdata_files_spec.rb
406
+ - spec/cocoa/timer_spec.rb
407
+ - spec/cocoa/base64_spec.rb
408
+ - spec/cocoa/nsattributedstring_spec.rb
409
+ - spec/helpers/attributed_string.rb