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 +4 -4
- data/README.md +6 -6
- data/lib/cocoa/sugarcube-nsdate/date_parser.rb +10 -4
- data/lib/sugarcube-corelocation.rb +4 -0
- data/lib/version.rb +1 -1
- data/spec/ios/core_location_spec.rb +2 -2
- data/spec/ios/image_scale_spec.rb +1 -1
- data/spec/ios/nsdate_spec.rb +3 -3
- data/spec/ios/nsstring_files_spec.rb +1 -1
- data/spec/ios/uicolor_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40fbf73a4729e86be4cbfb2206e7a4eed2e513cb
|
4
|
+
data.tar.gz: bd31a4f4ef0326fa17d5cbdea5fc45f250d5f670
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
=>
|
1755
|
+
=> 1779547.32010451 # in meters
|
1756
1756
|
> denver_co.distance_to(loveland_oh).in_miles
|
1757
|
-
=>
|
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.
|
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).
|
1764
|
-
=> 0.
|
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.
|
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 =
|
12
|
-
|
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",
|
data/lib/version.rb
CHANGED
@@ -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 ==
|
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 ==
|
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
|
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
|
|
data/spec/ios/nsdate_spec.rb
CHANGED
@@ -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
|
data/spec/ios/uicolor_spec.rb
CHANGED
@@ -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.
|
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.
|
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-
|
15
|
+
date: 2017-11-29 00:00:00.000000000 Z
|
16
16
|
dependencies: []
|
17
17
|
description: |
|
18
18
|
== Description
|