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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 51a608b443c4221e52c311ad2b469d1b3d5311cb
4
- data.tar.gz: 2ee0436cfcb032c3e4baa69762d6b3896b92b52c
3
+ metadata.gz: 24056054658a8d9d667528ba090aebc960d9f56d
4
+ data.tar.gz: 5310a03d3ee67c6a5624a5b82c7f4258dd4a6566
5
5
  SHA512:
6
- metadata.gz: ff411e63ace8b9b6be84dc7869abaf8e8625aaddb030f4ba353dac177c0cc371a5dc4189e6b6976306d9303094c12ce71f72ad68788bfd6f063c247b7ea834bb
7
- data.tar.gz: 5143fbb5bb99fc8dfcff2ca5966dc88347660838b20644cfa40585ce5e6c4ae39c679082c4abebf08509070787b9df99c83fc43566f69770c3a2ec39e2ed4c89
6
+ metadata.gz: 96b045011afcbc111031d23e5fc1f8f92b4cbf915504af2a59505c7e0abaae8b18d521245c3ec01c20d0363c05d77f474448f8fb6f8e0578faad93fe5ddc2130
7
+ data.tar.gz: 383170db59cc35c19f1b093a6dc2c5542457f3204ba9e2feb3b098fece16c94705d5514b6c31eee43a28706fa489ac7e664e002cd9c7383560a6419ace2c0305
@@ -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
@@ -1,3 +1,3 @@
1
1
  module BplEnrich
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -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
 
@@ -86,5 +86,95 @@ LCSHTest: test_lcsh_standardizer
86
86
   (0.0ms) begin transaction
87
87
  ---------------------------------
88
88
  DatesTest: test_date_standardizer
89
+ ---------------------------------
90
+  (0.0ms) rollback transaction
91
+  (0.1ms) begin transaction
92
+ -------------------------------
93
+ BplEnrichTest: test_strip_value
94
+ -------------------------------
95
+  (0.1ms) rollback transaction
96
+  (0.0ms) begin transaction
97
+ ---------------------------------
98
+ DatesTest: test_date_standardizer
99
+ ---------------------------------
100
+  (0.0ms) rollback transaction
101
+  (0.0ms) begin transaction
102
+ --------------------------------
103
+ LCSHTest: test_lcsh_standardizer
104
+ --------------------------------
105
+  (0.0ms) rollback transaction
106
+  (0.0ms) begin transaction
107
+ ------------------------------------
108
+ AuthoritiesTest: test_parse_language
109
+ ------------------------------------
110
+  (0.1ms) rollback transaction
111
+  (0.0ms) begin transaction
112
+ -----------------------------------------
113
+ AuthoritiesTest: test_parse_name_for_role
114
+ -----------------------------------------
115
+  (0.1ms) rollback transaction
116
+  (0.0ms) begin transaction
117
+ --------------------------------
118
+ AuthoritiesTest: test_parse_role
119
+ --------------------------------
120
+  (0.1ms) rollback transaction
121
+  (0.1ms) begin transaction
122
+ ---------------------------------
123
+ DatesTest: test_date_standardizer
124
+ ---------------------------------
125
+  (0.0ms) rollback transaction
126
+  (0.0ms) begin transaction
127
+ -------------------------------
128
+ BplEnrichTest: test_strip_value
129
+ -------------------------------
130
+  (0.0ms) rollback transaction
131
+  (0.0ms) begin transaction
132
+ --------------------------------
133
+ LCSHTest: test_lcsh_standardizer
134
+ --------------------------------
135
+  (0.0ms) rollback transaction
136
+  (0.1ms) begin transaction
137
+ ------------------------------------
138
+ AuthoritiesTest: test_parse_language
139
+ ------------------------------------
140
+  (0.1ms) rollback transaction
141
+  (0.0ms) begin transaction
142
+ -----------------------------------------
143
+ AuthoritiesTest: test_parse_name_for_role
144
+ -----------------------------------------
145
+  (0.1ms) rollback transaction
146
+  (0.0ms) begin transaction
147
+ --------------------------------
148
+ AuthoritiesTest: test_parse_role
149
+ --------------------------------
150
+  (0.1ms) rollback transaction
151
+  (0.1ms) begin transaction
152
+ --------------------------------
153
+ LCSHTest: test_lcsh_standardizer
154
+ --------------------------------
155
+  (0.0ms) rollback transaction
156
+  (0.0ms) begin transaction
157
+ ------------------------------------
158
+ AuthoritiesTest: test_parse_language
159
+ ------------------------------------
160
+  (0.1ms) rollback transaction
161
+  (0.0ms) begin transaction
162
+ -----------------------------------------
163
+ AuthoritiesTest: test_parse_name_for_role
164
+ -----------------------------------------
165
+  (0.1ms) rollback transaction
166
+  (0.0ms) begin transaction
167
+ --------------------------------
168
+ AuthoritiesTest: test_parse_role
169
+ --------------------------------
170
+  (0.1ms) rollback transaction
171
+  (0.0ms) begin transaction
172
+ -------------------------------
173
+ BplEnrichTest: test_strip_value
174
+ -------------------------------
175
+  (0.0ms) rollback transaction
176
+  (0.0ms) begin transaction
177
+ ---------------------------------
178
+ DatesTest: test_date_standardizer
89
179
  ---------------------------------
90
180
   (0.0ms) 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.3
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-06-06 00:00:00.000000000 Z
11
+ date: 2016-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails