bpl_enrich 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bpl_enrich/dates.rb +3 -1
- data/lib/bpl_enrich/version.rb +1 -1
- data/test/dates_test.rb +7 -0
- data/test/dummy/log/test.log +90 -0
- 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: 24056054658a8d9d667528ba090aebc960d9f56d
|
4
|
+
data.tar.gz: 5310a03d3ee67c6a5624a5b82c7f4258dd4a6566
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96b045011afcbc111031d23e5fc1f8f92b4cbf915504af2a59505c7e0abaae8b18d521245c3ec01c20d0363c05d77f474448f8fb6f8e0578faad93fe5ddc2130
|
7
|
+
data.tar.gz: 383170db59cc35c19f1b093a6dc2c5542457f3204ba9e2feb3b098fece16c94705d5514b6c31eee43a28706fa489ac7e664e002cd9c7383560a6419ace2c0305
|
data/lib/bpl_enrich/dates.rb
CHANGED
@@ -261,7 +261,9 @@ module BplEnrich
|
|
261
261
|
date_data[:single_date] = split_value
|
262
262
|
elsif split_value.match(/\A[01]?[1-9][-\/\.][01]?[1-9][-\/\.][12]\d\d\d\z/) # mm-dd-yyyy || m-dd-yyyy || mm/dd/yyyy
|
263
263
|
split_value = split_value.gsub(/[,\/\.]/, '/').squeeze('-')
|
264
|
-
date_data[:single_date] = "#{split_value.split('/')[2]}-#{split_value.split('/')[0]}-#{split_value.split('/')[1]}"
|
264
|
+
date_data[:single_date] = "#{split_value.split('/')[2]}-#{split_value.split('/')[0]}-#{split_value.split('/')[1]}" if split_value.include?('/')
|
265
|
+
date_data[:single_date] = "#{split_value.split('-')[2]}-#{split_value.split('-')[0]}-#{split_value.split('-')[1]}" if split_value.include?('-')
|
266
|
+
date_data[:single_date] = "#{split_value.split('.')[2]}-#{split_value.split('.')[0]}-#{split_value.split('.')[1]}" if split_value.include?('.')
|
265
267
|
end
|
266
268
|
|
267
269
|
end
|
data/lib/bpl_enrich/version.rb
CHANGED
data/test/dates_test.rb
CHANGED
@@ -45,6 +45,13 @@ class DatesTest < ActiveSupport::TestCase
|
|
45
45
|
assert_equal '1860-10', result[:date_range][:start]
|
46
46
|
assert_equal '1862-04', result[:date_range][:end]
|
47
47
|
assert_equal nil, result[:date_note]
|
48
|
+
|
49
|
+
|
50
|
+
result = BplEnrich::Dates.standardize('[11-12-1928?]')
|
51
|
+
assert_equal '1928-11-12', result[:single_date]
|
52
|
+
assert_equal nil, result[:date_range]
|
53
|
+
assert_equal nil, result[:date_note]
|
54
|
+
assert_equal 'questionable', result[:date_qualifier]
|
48
55
|
end
|
49
56
|
|
50
57
|
|
data/test/dummy/log/test.log
CHANGED
@@ -86,5 +86,95 @@ LCSHTest: test_lcsh_standardizer
|
|
86
86
|
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
87
87
|
---------------------------------
|
88
88
|
DatesTest: test_date_standardizer
|
89
|
+
---------------------------------
|
90
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
91
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
92
|
+
-------------------------------
|
93
|
+
BplEnrichTest: test_strip_value
|
94
|
+
-------------------------------
|
95
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
96
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
97
|
+
---------------------------------
|
98
|
+
DatesTest: test_date_standardizer
|
99
|
+
---------------------------------
|
100
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
101
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
102
|
+
--------------------------------
|
103
|
+
LCSHTest: test_lcsh_standardizer
|
104
|
+
--------------------------------
|
105
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
106
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
107
|
+
------------------------------------
|
108
|
+
AuthoritiesTest: test_parse_language
|
109
|
+
------------------------------------
|
110
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
111
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
112
|
+
-----------------------------------------
|
113
|
+
AuthoritiesTest: test_parse_name_for_role
|
114
|
+
-----------------------------------------
|
115
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
116
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
117
|
+
--------------------------------
|
118
|
+
AuthoritiesTest: test_parse_role
|
119
|
+
--------------------------------
|
120
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
121
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
122
|
+
---------------------------------
|
123
|
+
DatesTest: test_date_standardizer
|
124
|
+
---------------------------------
|
125
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
126
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
127
|
+
-------------------------------
|
128
|
+
BplEnrichTest: test_strip_value
|
129
|
+
-------------------------------
|
130
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
131
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
132
|
+
--------------------------------
|
133
|
+
LCSHTest: test_lcsh_standardizer
|
134
|
+
--------------------------------
|
135
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
136
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
137
|
+
------------------------------------
|
138
|
+
AuthoritiesTest: test_parse_language
|
139
|
+
------------------------------------
|
140
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
141
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
142
|
+
-----------------------------------------
|
143
|
+
AuthoritiesTest: test_parse_name_for_role
|
144
|
+
-----------------------------------------
|
145
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
146
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
147
|
+
--------------------------------
|
148
|
+
AuthoritiesTest: test_parse_role
|
149
|
+
--------------------------------
|
150
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
151
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
152
|
+
--------------------------------
|
153
|
+
LCSHTest: test_lcsh_standardizer
|
154
|
+
--------------------------------
|
155
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
156
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
157
|
+
------------------------------------
|
158
|
+
AuthoritiesTest: test_parse_language
|
159
|
+
------------------------------------
|
160
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
161
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
162
|
+
-----------------------------------------
|
163
|
+
AuthoritiesTest: test_parse_name_for_role
|
164
|
+
-----------------------------------------
|
165
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
166
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
167
|
+
--------------------------------
|
168
|
+
AuthoritiesTest: test_parse_role
|
169
|
+
--------------------------------
|
170
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
171
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
172
|
+
-------------------------------
|
173
|
+
BplEnrichTest: test_strip_value
|
174
|
+
-------------------------------
|
175
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
176
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
177
|
+
---------------------------------
|
178
|
+
DatesTest: test_date_standardizer
|
89
179
|
---------------------------------
|
90
180
|
[1m[35m (0.0ms)[0m rollback transaction
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bpl_enrich
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boston Public Library
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|