sugarcube 3.4.1 → 3.4.2

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: 8cafb2361552a041c24b9e363c89a977c51d0555
4
- data.tar.gz: a5748317cfb7ddca118cd9f95d58e437e63147e9
3
+ metadata.gz: 40fbf73a4729e86be4cbfb2206e7a4eed2e513cb
4
+ data.tar.gz: bd31a4f4ef0326fa17d5cbdea5fc45f250d5f670
5
5
  SHA512:
6
- metadata.gz: 17ee322c4bc4c1d054db7ba41b4382f0de7d992aebe266e0101df4e79c17d8f3be97dcc2952779d96baa5ee1a56e3f0f56c2bc232084eb5f18c059afd7a8943e
7
- data.tar.gz: fab4014b589e6399719a14c215c74b3980e19cb69be2c7edcdab7721e6fb6b14bbc73469ec5b2b206dc09378fb34066555b94b911476b19d0f9ad65c7135aebb
6
+ metadata.gz: 6c67338b6955217169f8913cb329734b4b175124a97506c4d9cd44e23612b82487a09f43ce7a8f61e6db52a3bd1e1db3e03541a02d624e532a29b840a41779f8
7
+ data.tar.gz: 41a5308e47bf580afd1ed7d8d4e7d02fe8d287f75efe383cadbd3ad6a40512248f5d92487e3255f9cf45cd6e6f8972a5acd444916fb07c70a0c61b4ea621b12b
data/README.md CHANGED
@@ -1752,19 +1752,19 @@ Open up `CLLocationCoordinate2D` to provide handy-dandies
1752
1752
  > loveland_oh = CLLocationCoordinate2D.new(39.268128, -84.257648)
1753
1753
  => #<CLLocationCoordinate2D latitude=39.2681274414062 longitude=-84.2576293945312>
1754
1754
  > denver_co.distance_to(loveland_oh)
1755
- => 1773425.54893302 # in meters
1755
+ => 1779547.32010451 # in meters
1756
1756
  > denver_co.distance_to(loveland_oh).in_miles
1757
- => 1101.95556640625
1757
+ => 1105.75943993609
1758
1758
 
1759
1759
  # move around the globe using x/y distances in miles or kilometers
1760
1760
  > denver_co.delta_miles(1101.6, -32.556)
1761
- => #<CLLocationCoordinate2D latitude=39.2681427001953 longitude=-84.2577209472656>
1761
+ => #<CLLocationCoordinate2D latitude=39.2685263870498 longitude=-84.2744401887072>
1762
1762
  # our location is pretty close!
1763
- > denver_co.delta_miles(1101.6, -32.556).distance_to(loveland_oh).miles
1764
- => 0.90043306350708
1763
+ > denver_co.delta_miles(1101.6, -32.556).distance_to(loveland_oh).in_miles
1764
+ => 0.900871117223827
1765
1765
 
1766
1766
  > denver_co.delta_kilometers(10, 10) # 10 kilometers east, 10 kilometers north
1767
- => #<CLLocationCoordinate2D latitude=39.8290100097656 longitude=-104.868377685547>
1767
+ => #<CLLocationCoordinate2D latitude=39.8290195284119 longitude=-104.868401269013>
1768
1768
  ```
1769
1769
 
1770
1770
  Pipes
@@ -8,11 +8,10 @@ module SugarCube
8
8
  #
9
9
  # => 2013-02-20 09:00:00 -0800
10
10
  def parse_date(date_string)
11
- result = sugarcube_detect(date_string).first
12
- if result
11
+ if result = iso8601(date_string)
12
+ return result
13
+ elsif result = sugarcube_detect(date_string).first
13
14
  return result.date
14
- else
15
- return iso8601(date_string)
16
15
  end
17
16
  end
18
17
 
@@ -45,6 +44,13 @@ module SugarCube
45
44
  end
46
45
 
47
46
  def iso8601(date_string)
47
+ if defined? NSISO8601DateFormatter
48
+ formatter = NSISO8601DateFormatter.alloc.init
49
+ formatter.timeZone = NSTimeZone.timeZoneWithAbbreviation "UTC"
50
+ date = formatter.dateFromString date_string
51
+ return date if date
52
+ end
53
+
48
54
  @@sugarcube_iso_detectors ||= [
49
55
  "yyyy-MM-dd'T'HH:mm:ss",
50
56
  "yyyy-MM-dd'T'HH:mm:ssZ",
@@ -9,3 +9,7 @@ SugarCube.cocoa_only!('corelocation')
9
9
  Motion::Project::App.pre_setup do |app|
10
10
  SugarCube.add_app_files(app, 'sugarcube-corelocation')
11
11
  end
12
+
13
+ Motion::Project::App.post_setup do |app|
14
+ app.frameworks += %w{CoreLocation}
15
+ end
@@ -1,3 +1,3 @@
1
1
  module SugarCube
2
- Version = '3.4.1'
2
+ Version = '3.4.2'
3
3
  end
@@ -5,11 +5,11 @@ describe "CoreLocation" do
5
5
  end
6
6
 
7
7
  it "should calculate distance in miles" do
8
- @denver.distance_to(@cincinnati).in_miles.round.should == 1101
8
+ @denver.distance_to(@cincinnati).in_miles.round.should == 1105
9
9
  end
10
10
 
11
11
  it "should calculate distance in kilometers" do
12
- @denver.distance_to(@cincinnati).in_kilometers.round.should == 1772
12
+ @denver.distance_to(@cincinnati).in_kilometers.round.should == 1778
13
13
  end
14
14
 
15
15
  end
@@ -78,7 +78,7 @@ describe "UIImage scale methods" do
78
78
  end
79
79
 
80
80
  it 'should be able to change scale' do
81
- if UIScreen.mainScreen.scale == 2
81
+ if UIScreen.mainScreen.scale >= 2
82
82
  scaled = @image.at_scale(1.0)
83
83
  scaled.nsdata.writeToFile('at_scale.png'.document_path, atomically: true)
84
84
 
@@ -105,13 +105,13 @@ describe "NSDate" do
105
105
 
106
106
  it "should have an NSDate#string_with_format(locale: (France))" do
107
107
  locale = NSLocale.localeWithLocaleIdentifier('fr')
108
- @date.string_with_format('yyyyMMMMd HH:mm:ss', locale: locale).should == '2 January 2013 12:15:30'
108
+ @date.string_with_format('yyyyMMMMd HH:mm:ss', locale: locale).should == '2 January 2013 à 12:15:30'
109
109
  end
110
110
 
111
111
  it "should have an NSDate#string_with_format(locale: 'fr')" do
112
- @date.string_with_format('yyyyMMMMd HH:mm:ss', locale: 'fr').should == '2 January 2013 12:15:30'
112
+ @date.string_with_format('yyyyMMMMd HH:mm:ss', locale: 'fr').should == '2 January 2013 à 12:15:30'
113
113
  # these formatters get cached, and it's important to test the cache:
114
- @date.string_with_format('yyyyMMMMd HH:mm:ss', locale: 'fr').should == '2 January 2013 12:15:30'
114
+ @date.string_with_format('yyyyMMMMd HH:mm:ss', locale: 'fr').should == '2 January 2013 à 12:15:30'
115
115
  end
116
116
 
117
117
  it "should have an NSDate#string_with_format method (:iso8601)" do
@@ -89,7 +89,7 @@ describe 'NSString' do
89
89
 
90
90
  describe "in resource" do
91
91
  it "should be file_exists" do
92
- "info.plist".resource_path.file_exists?.should == true
92
+ "Info.plist".resource_path.file_exists?.should == true
93
93
  end
94
94
  end
95
95
 
@@ -42,7 +42,7 @@ describe "UIColor" do
42
42
  '#ffffff'.uicolor.darken(0.1).lighten(0.1).hex.should == '#ffffff'.uicolor.hex
43
43
  end
44
44
  it "should lighten" do
45
- '#e6e6e6'.uicolor.lighten(0.1).hex.should == '#ffffff'.uicolor.hex
45
+ '#e6e6e6'.uicolor.lighten(0.0999999).hex.should == '#ffffff'.uicolor.hex
46
46
  end
47
47
  it "should invert lighten" do
48
48
  '#e5e5e5'.uicolor.lighten(0.1).darken(0.1).hex.should == '#e5e5e5'.uicolor.hex
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.1
4
+ version: 3.4.2
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: 2017-11-27 00:00:00.000000000 Z
15
+ date: 2017-11-29 00:00:00.000000000 Z
16
16
  dependencies: []
17
17
  description: |
18
18
  == Description