sixarm_ruby_to_id 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -1
- data/VERSION +1 -1
- data/lib/sixarm_ruby_to_id/string.rb +15 -2
- data/test/sixarm_ruby_to_id_test/array_test.rb +2 -2
- data/test/sixarm_ruby_to_id_test/string_test.rb +6 -4
- data.tar.gz.sig +2 -1
- metadata +2 -2
- metadata.gz.sig +1 -1
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.8
|
@@ -25,12 +25,25 @@ class String
|
|
25
25
|
|
26
26
|
# Cast me to a stint id.
|
27
27
|
#
|
28
|
-
#
|
28
|
+
# The string is two ISO dates in YYYY-MM-DD.
|
29
|
+
#
|
30
|
+
# The separator is either:
|
31
|
+
#
|
32
|
+
# * two dots ".." to include the stop date
|
33
|
+
#
|
34
|
+
# * three dots "..." to exclude the stop date.
|
35
|
+
#
|
36
|
+
# Examples:
|
37
|
+
#
|
38
|
+
# " 2000-12-30..2000-12-31".to_stint_id
|
39
|
+
# #=> "2000-12-30-2000-12-31"
|
40
|
+
#
|
41
|
+
# " 2000-12-30...2000-12-31".to_stint_id
|
29
42
|
# #=> "2000-12-30-2000-12-31"
|
30
43
|
#
|
31
44
|
def to_stint_id
|
32
45
|
s = self.strip
|
33
|
-
s =~ /\A\d\d\d\d-\d\d-\d\d
|
46
|
+
s =~ /\A\d\d\d\d-\d\d-\d\d\.\.\.?\d\d\d\d-\d\d-\d\d\z/ ? s : nil
|
34
47
|
end
|
35
48
|
|
36
49
|
|
@@ -13,8 +13,8 @@ describe Array do
|
|
13
13
|
|
14
14
|
describe "#to_stint_ids" do
|
15
15
|
it "casts the items to stint ids" do
|
16
|
-
[" 2000-12-30
|
17
|
-
["
|
16
|
+
[" 2000-12-30..2000-12-31 ", " 2001-12-30..2001-12-31 ", " 2002-12-30..2002-12-31 "].to_stint_ids.must_equal ["2000-12-30..2000-12-31", "2001-12-30..2001-12-31", "2002-12-30..2002-12-31"]
|
17
|
+
[" A000-12-30..2000-12-31 ", " B001-12-30..2001-12-31 ", " C002-12-30..2002-12-31 "].to_stint_ids.must_equal [nil, nil, nil]
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -20,15 +20,17 @@ describe String do
|
|
20
20
|
|
21
21
|
describe "#to_stint_id" do
|
22
22
|
it "casts me to a stint id [YYYY-MM-DD, YYYY-MM-DD]" do
|
23
|
-
" 2000-12-30
|
24
|
-
"
|
23
|
+
" 2000-12-30..2000-12-31 ".to_stint_id.must_equal "2000-12-30..2000-12-31"
|
24
|
+
" 2000-12-30...2000-12-31 ".to_stint_id.must_equal "2000-12-30...2000-12-31"
|
25
|
+
" 2000-12-30-2000-12-31 ".to_stint_id.must_equal nil
|
26
|
+
" 2000-12-30 2000-12-31 ".to_stint_id.must_equal nil
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
28
30
|
describe "#to_stint_ids" do
|
29
31
|
it "casts me to a list of stint ids" do
|
30
|
-
" 2000-12-30
|
31
|
-
"
|
32
|
+
" 2000-12-30..2000-12-31 , 2001-12-30..2001-12-31 , 2002-12-30..2002-12-31 ".to_stint_ids.must_equal ["2000-12-30..2000-12-31", "2001-12-30..2001-12-31", "2002-12-30..2002-12-31"]
|
33
|
+
" A000-12-30..2000-12-31 , B001-12-30..2001-12-31 , C002-12-30..2002-12-31 ".to_stint_ids.must_equal [nil, nil, nil]
|
32
34
|
end
|
33
35
|
end
|
34
36
|
|
data.tar.gz.sig
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
��;�4Ƿ�9�n���RE:W� $,��J�Ѭ��ʋ+l"��ח��g���[��u+�}`TT:X#>�Y��"z��������
|
2
|
+
K=�8���8�v)бKFu
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sixarm_ruby_to_id
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
L2RORkllUkVIekVSClpEUlFZTXFydTlURU1uYTZIRDl6cGNzdEY3dndUaEdv
|
36
36
|
dmxPUSszWTZwbFE0bk16aXBYY1o5VEhxczY1UElMMHEKZWFid3BDYkFvcG89
|
37
37
|
Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
|
38
|
-
date: 2012-
|
38
|
+
date: 2012-09-22 00:00:00.000000000 Z
|
39
39
|
dependencies: []
|
40
40
|
description:
|
41
41
|
email: sixarm@sixarm.com
|
metadata.gz.sig
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Z(��yTb�s�>�|��4j��Rb�k aBH��Ul�=�hۏ��S��b/\��Ce+�ZAg�V!���|�1����s<�}Oc��6�,��+ �\�#
|