data_cleansing 1.0.2 → 1.0.3
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/Rakefile +17 -7
- data/lib/data_cleansing/cleaners.rb +22 -18
- data/lib/data_cleansing/cleanse.rb +29 -32
- data/lib/data_cleansing/data_cleansing.rb +2 -2
- data/lib/data_cleansing/railtie.rb +0 -1
- data/lib/data_cleansing/version.rb +1 -1
- data/lib/data_cleansing.rb +6 -8
- data/test/active_record_test.rb +53 -56
- data/test/cleaners_test.rb +79 -80
- data/test/data_cleansing_test.rb +4 -4
- data/test/ruby_test.rb +47 -49
- data/test/test_db.sqlite3 +0 -0
- data/test/test_helper.rb +6 -6
- metadata +11 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04a8c565168dcba73088d9e17afcda3ab49097a41fb55bcf880f2cd04e6d38bf
|
4
|
+
data.tar.gz: da24439e8431d81c19241b7ed579bd73170cfc8e61c1781bc103befa1e37d6fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28d9b9af8b18271bcbedd3930b0c1882ee162470959992ab2140f4a733377aaffadb0efef52d66ffeb86a93b1c10cdbcc78d61382d09fd85f8135596bd845628
|
7
|
+
data.tar.gz: f49c9062ffa4620c723cdb1d114f3baf649b63cb273dc67cadb34212cdf1d42c54a1ad4be90cff38e02f565c2135d18c3d58ccd0e90c3031e65dfe3fbef0e01c
|
data/Rakefile
CHANGED
@@ -1,21 +1,31 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# Setup bundler to avoid having to run bundle exec all the time.
|
2
|
+
require "rubygems"
|
3
|
+
require "bundler/setup"
|
4
|
+
|
5
|
+
require "rake/testtask"
|
6
|
+
require_relative "lib/data_cleansing/version"
|
3
7
|
|
4
8
|
task :gem do
|
5
|
-
system
|
9
|
+
system "gem build data_cleansing.gemspec"
|
6
10
|
end
|
7
11
|
|
8
12
|
task publish: :gem do
|
9
13
|
system "git tag -a v#{DataCleansing::VERSION} -m 'Tagging #{DataCleansing::VERSION}'"
|
10
|
-
system
|
14
|
+
system "git push --tags"
|
11
15
|
system "gem push data_cleansing-#{DataCleansing::VERSION}.gem"
|
12
16
|
system "rm data_cleansing-#{DataCleansing::VERSION}.gem"
|
13
17
|
end
|
14
18
|
|
15
19
|
Rake::TestTask.new(:test) do |t|
|
16
|
-
t.pattern =
|
20
|
+
t.pattern = "test/**/*_test.rb"
|
17
21
|
t.verbose = true
|
18
|
-
t.warning =
|
22
|
+
t.warning = false
|
19
23
|
end
|
20
24
|
|
21
|
-
|
25
|
+
# By default run tests against all appraisals
|
26
|
+
if !ENV["APPRAISAL_INITIALIZED"] && !ENV["TRAVIS"]
|
27
|
+
require "appraisal"
|
28
|
+
task default: :appraisal
|
29
|
+
else
|
30
|
+
task default: :test
|
31
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "cgi"
|
2
2
|
module Cleaners
|
3
3
|
# Strip leading and trailing whitespace
|
4
4
|
module Strip
|
@@ -37,7 +37,7 @@ module Cleaners
|
|
37
37
|
def self.call(string)
|
38
38
|
return string unless string.is_a?(String)
|
39
39
|
|
40
|
-
string.gsub!(NOT_WORDS,
|
40
|
+
string.gsub!(NOT_WORDS, "") || string
|
41
41
|
end
|
42
42
|
end
|
43
43
|
DataCleansing.register_cleaner(:remove_non_word, RemoveNonWord)
|
@@ -49,6 +49,10 @@ module Cleaners
|
|
49
49
|
def self.call(string)
|
50
50
|
return string unless string.is_a?(String)
|
51
51
|
|
52
|
+
# Strip invalid characters, since they are non printable
|
53
|
+
unless string.valid_encoding?
|
54
|
+
string = string.encode(string.encoding, invalid: :replace, undef: :replace, replace: "")
|
55
|
+
end
|
52
56
|
string.gsub!(NOT_PRINTABLE, '') || string
|
53
57
|
end
|
54
58
|
end
|
@@ -63,18 +67,18 @@ module Cleaners
|
|
63
67
|
|
64
68
|
string.gsub!(HTML_MARKUP) do |match|
|
65
69
|
case match.downcase
|
66
|
-
when
|
67
|
-
|
68
|
-
when
|
70
|
+
when "&"
|
71
|
+
"&"
|
72
|
+
when """
|
69
73
|
'"'
|
70
|
-
when
|
71
|
-
|
72
|
-
when
|
73
|
-
|
74
|
-
when
|
74
|
+
when ">"
|
75
|
+
">"
|
76
|
+
when "<"
|
77
|
+
"<"
|
78
|
+
when "'"
|
75
79
|
"'"
|
76
|
-
when
|
77
|
-
|
80
|
+
when " "
|
81
|
+
" "
|
78
82
|
else
|
79
83
|
"&#{match};"
|
80
84
|
end
|
@@ -108,7 +112,7 @@ module Cleaners
|
|
108
112
|
def self.call(string)
|
109
113
|
return string unless string.is_a?(String)
|
110
114
|
|
111
|
-
string.gsub!(WHITESPACE,
|
115
|
+
string.gsub!(WHITESPACE, " ") || string
|
112
116
|
end
|
113
117
|
end
|
114
118
|
DataCleansing.register_cleaner(:compress_whitespace, CompressWhitespace)
|
@@ -121,7 +125,7 @@ module Cleaners
|
|
121
125
|
def self.call(string)
|
122
126
|
return string unless string.is_a?(String)
|
123
127
|
|
124
|
-
string.gsub!(DIGITS,
|
128
|
+
string.gsub!(DIGITS, "")
|
125
129
|
string.length > 0 ? string : nil
|
126
130
|
end
|
127
131
|
end
|
@@ -130,13 +134,13 @@ module Cleaners
|
|
130
134
|
# Returns [Integer] after removing all non-digit characters, except '.'
|
131
135
|
# Returns nil if no digits are present in the string.
|
132
136
|
module StringToInteger
|
133
|
-
NUMERIC = Regexp.compile(/[^0-9
|
137
|
+
NUMERIC = Regexp.compile(/[^0-9.]/)
|
134
138
|
|
135
139
|
def self.call(string)
|
136
140
|
return string unless string.is_a?(String)
|
137
141
|
|
138
142
|
# Remove Non-Digit Chars, except for '.'
|
139
|
-
string.gsub!(NUMERIC,
|
143
|
+
string.gsub!(NUMERIC, "")
|
140
144
|
string.length > 0 ? string.to_i : nil
|
141
145
|
end
|
142
146
|
end
|
@@ -145,13 +149,13 @@ module Cleaners
|
|
145
149
|
# Returns [Integer] after removing all non-digit characters, except '.'
|
146
150
|
# Returns nil if no digits are present in the string.
|
147
151
|
module StringToFloat
|
148
|
-
NUMERIC = Regexp.compile(/[^0-9
|
152
|
+
NUMERIC = Regexp.compile(/[^0-9.]/)
|
149
153
|
|
150
154
|
def self.call(string)
|
151
155
|
return string unless string.is_a?(String)
|
152
156
|
|
153
157
|
# Remove Non-Digit Chars, except for '.'
|
154
|
-
string.gsub!(NUMERIC,
|
158
|
+
string.gsub!(NUMERIC, "")
|
155
159
|
string.length > 0 ? string.to_f : nil
|
156
160
|
end
|
157
161
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "data_cleansing/cleaners"
|
2
2
|
module DataCleansing
|
3
3
|
# Mix-in to add cleaner
|
4
4
|
module Cleanse
|
@@ -9,7 +9,7 @@ module DataCleansing
|
|
9
9
|
def cleanse(*args)
|
10
10
|
last = args.last
|
11
11
|
attributes = args.dup
|
12
|
-
params =
|
12
|
+
params = last.is_a?(Hash) && last.instance_of?(Hash) ? attributes.pop.dup : {}
|
13
13
|
cleaners = Array(params.delete(:cleaner))
|
14
14
|
raise(ArgumentError, "Mandatory :cleaner parameter is missing: #{params.inspect}") unless cleaners
|
15
15
|
|
@@ -34,6 +34,7 @@ module DataCleansing
|
|
34
34
|
def after_cleanse(*methods)
|
35
35
|
methods.each do |m|
|
36
36
|
raise "Method #{m.inspect} must be a symbol" unless m.is_a?(Symbol)
|
37
|
+
|
37
38
|
data_cleansing_after_cleaners << m unless data_cleansing_after_cleaners.include?(m)
|
38
39
|
end
|
39
40
|
end
|
@@ -53,7 +54,7 @@ module DataCleansing
|
|
53
54
|
#
|
54
55
|
# Warning: If any of the cleaners read or write to other object attributes
|
55
56
|
# then a valid object instance must be supplied
|
56
|
-
def cleanse_attribute(attribute_name, value, object=nil)
|
57
|
+
def cleanse_attribute(attribute_name, value, object = nil)
|
57
58
|
return if value.nil?
|
58
59
|
|
59
60
|
# Collect parent cleaners first, starting with the top parent
|
@@ -100,6 +101,7 @@ module DataCleansing
|
|
100
101
|
# itself is not modified
|
101
102
|
def data_cleansing_clean(cleaner_struct, value, binding = nil)
|
102
103
|
return if cleaner_struct.nil? || value.nil?
|
104
|
+
|
103
105
|
# Duplicate value in case cleaner uses methods such as gsub!
|
104
106
|
new_value = value.is_a?(String) ? value.dup : value
|
105
107
|
cleaner_struct.cleaners.each do |name|
|
@@ -107,7 +109,6 @@ module DataCleansing
|
|
107
109
|
end
|
108
110
|
new_value
|
109
111
|
end
|
110
|
-
|
111
112
|
end
|
112
113
|
|
113
114
|
module InstanceMethods
|
@@ -118,9 +119,9 @@ module DataCleansing
|
|
118
119
|
#
|
119
120
|
# Note: At this time the changes returned does not include any fields
|
120
121
|
# modified in any of the after_cleaner methods
|
121
|
-
def cleanse_attributes!(verbose=DataCleansing.logger.debug?)
|
122
|
+
def cleanse_attributes!(verbose = DataCleansing.logger.debug?)
|
122
123
|
changes = {}
|
123
|
-
DataCleansing.logger.benchmark_info("#{self.class.name}#cleanse_attributes!", :
|
124
|
+
DataCleansing.logger.benchmark_info("#{self.class.name}#cleanse_attributes!", payload: changes) do
|
124
125
|
# Collect parent cleaners first, starting with the top parent
|
125
126
|
cleaners = [self.class.send(:data_cleansing_cleaners)]
|
126
127
|
after_cleaners = [self.class.send(:data_cleansing_after_cleaners)]
|
@@ -194,36 +195,33 @@ module DataCleansing
|
|
194
195
|
end
|
195
196
|
|
196
197
|
# No need to clean if attribute is nil
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
end
|
220
|
-
end
|
198
|
+
next if value.nil?
|
199
|
+
|
200
|
+
new_value = self.class.send(:data_cleansing_clean, cleaner_struct, value, self)
|
201
|
+
|
202
|
+
next unless new_value != value
|
203
|
+
|
204
|
+
# Update value only if it has changed
|
205
|
+
send("#{attr.to_sym}=".to_sym, new_value)
|
206
|
+
|
207
|
+
# Capture changed attributes
|
208
|
+
next unless changes
|
209
|
+
|
210
|
+
# Mask sensitive attributes when logging
|
211
|
+
masked = DataCleansing.masked_attributes.include?(attr.to_sym)
|
212
|
+
new_value = :masked if masked && !new_value.nil?
|
213
|
+
if previous = changes[attr.to_sym]
|
214
|
+
previous[:after] = new_value
|
215
|
+
elsif new_value.nil? || verbose
|
216
|
+
changes[attr.to_sym] = {
|
217
|
+
before: masked ? :masked : value,
|
218
|
+
after: new_value
|
219
|
+
}
|
221
220
|
end
|
222
221
|
end
|
223
222
|
end
|
224
223
|
changes
|
225
224
|
end
|
226
|
-
|
227
225
|
end
|
228
226
|
|
229
227
|
def self.included(base)
|
@@ -233,5 +231,4 @@ module DataCleansing
|
|
233
231
|
end
|
234
232
|
end
|
235
233
|
end
|
236
|
-
|
237
234
|
end
|
@@ -9,6 +9,7 @@ module DataCleansing
|
|
9
9
|
# Replaces any existing cleaner with the same name
|
10
10
|
def self.register_cleaner(name, cleaner = nil, &block)
|
11
11
|
raise "Must supply a Proc with the cleaner" unless block || cleaner
|
12
|
+
|
12
13
|
@@global_cleaners[name.to_sym] = cleaner || block
|
13
14
|
end
|
14
15
|
|
@@ -19,7 +20,7 @@ module DataCleansing
|
|
19
20
|
|
20
21
|
# Register Attributes to be masked out in any log output
|
21
22
|
def self.register_masked_attributes(*attributes)
|
22
|
-
attributes.each {|attr| @@masked_attributes << attr.to_sym }
|
23
|
+
attributes.each { |attr| @@masked_attributes << attr.to_sym }
|
23
24
|
end
|
24
25
|
|
25
26
|
# Returns the Global list of attributes to mask in any log output
|
@@ -44,5 +45,4 @@ module DataCleansing
|
|
44
45
|
(proc.method(:call).arity == 1 ? proc.call(value) : proc.call(value, params))
|
45
46
|
end
|
46
47
|
end
|
47
|
-
|
48
48
|
end
|
data/lib/data_cleansing.rb
CHANGED
@@ -1,13 +1,11 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require "concurrent"
|
2
|
+
require "semantic_logger"
|
3
|
+
require "data_cleansing/version"
|
4
|
+
require "data_cleansing/data_cleansing"
|
5
5
|
|
6
6
|
module DataCleansing
|
7
|
-
autoload :Cleanse,
|
7
|
+
autoload :Cleanse, "data_cleansing/cleanse"
|
8
8
|
end
|
9
9
|
|
10
10
|
# Rails Extensions
|
11
|
-
if defined?(Rails)
|
12
|
-
require 'data_cleansing/railtie'
|
13
|
-
end
|
11
|
+
require "data_cleansing/railtie" if defined?(Rails)
|
data/test/active_record_test.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
require_relative
|
2
|
-
require
|
1
|
+
require_relative "test_helper"
|
2
|
+
require "active_record"
|
3
3
|
|
4
4
|
ActiveRecord::Base.logger = SemanticLogger[ActiveRecord::Base]
|
5
5
|
ActiveRecord::Base.configurations = {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
"test" => {
|
7
|
+
"adapter" => "sqlite3",
|
8
|
+
"database" => "test/test_db.sqlite3",
|
9
|
+
"pool" => 5,
|
10
|
+
"timeout" => 5000
|
11
11
|
}
|
12
12
|
}
|
13
13
|
ActiveRecord::Base.establish_connection(:test)
|
14
14
|
|
15
|
-
ActiveRecord::Schema.define :
|
16
|
-
create_table :users, :
|
15
|
+
ActiveRecord::Schema.define version: 0 do
|
16
|
+
create_table :users, force: true do |t|
|
17
17
|
t.string :first_name
|
18
18
|
t.string :last_name
|
19
19
|
t.string :address1
|
@@ -38,13 +38,13 @@ class User < ActiveRecord::Base
|
|
38
38
|
attr_accessor :instance_var
|
39
39
|
|
40
40
|
# Use a global cleaner
|
41
|
-
cleanse :first_name, :last_name, :
|
41
|
+
cleanse :first_name, :last_name, cleaner: :strip
|
42
42
|
|
43
43
|
# Define a once off cleaner
|
44
|
-
cleanse :address1, :address2, :instance_var, :
|
44
|
+
cleanse :address1, :address2, :instance_var, cleaner: proc { |string| "<< #{string.strip} >>" }
|
45
45
|
|
46
46
|
# Custom Zip Code cleaner
|
47
|
-
cleanse :zip_code, :
|
47
|
+
cleanse :zip_code, cleaner: :string_to_integer
|
48
48
|
|
49
49
|
# Automatically cleanse data before validation
|
50
50
|
before_validation :cleanse_attributes!
|
@@ -53,107 +53,104 @@ end
|
|
53
53
|
class User2 < ActiveRecord::Base
|
54
54
|
include DataCleansing::Cleanse
|
55
55
|
# Use the same table as User above
|
56
|
-
self.table_name =
|
56
|
+
self.table_name = "users"
|
57
57
|
|
58
58
|
serialize :text
|
59
59
|
|
60
60
|
# Test :all cleaner. Only works with ActiveRecord Models
|
61
61
|
# Must explicitly excelude :text since it is serialized
|
62
|
-
cleanse :all, :
|
62
|
+
cleanse :all, cleaner: [:strip, proc { |s| "@#{s}@" }], except: %i[address1 zip_code text]
|
63
63
|
|
64
64
|
# Clean :first_name multiple times
|
65
|
-
cleanse :first_name, :
|
65
|
+
cleanse :first_name, cleaner: proc { |string| "<< #{string} >>" }
|
66
66
|
|
67
67
|
# Clean :first_name multiple times
|
68
|
-
cleanse :first_name, :
|
68
|
+
cleanse :first_name, cleaner: proc { |string| "$#{string}$" }
|
69
69
|
|
70
70
|
# Custom Zip Code cleaner
|
71
|
-
cleanse :zip_code, :
|
71
|
+
cleanse :zip_code, cleaner: :string_to_integer
|
72
72
|
|
73
73
|
# Automatically cleanse data before validation
|
74
74
|
before_validation :cleanse_attributes!
|
75
75
|
end
|
76
76
|
|
77
77
|
class ActiveRecordTest < Minitest::Test
|
78
|
-
describe
|
79
|
-
|
80
|
-
it 'have globally registered cleaner' do
|
78
|
+
describe "ActiveRecord Models" do
|
79
|
+
it "have globally registered cleaner" do
|
81
80
|
assert DataCleansing.cleaner(:strip)
|
82
81
|
end
|
83
82
|
|
84
|
-
it
|
85
|
-
assert_equal
|
86
|
-
assert_equal
|
87
|
-
assert_equal
|
88
|
-
assert_equal
|
89
|
-
assert_equal
|
83
|
+
it "Model.cleanse_attribute" do
|
84
|
+
assert_equal "joe", User.cleanse_attribute(:first_name, " joe ")
|
85
|
+
assert_equal "black", User.cleanse_attribute(:last_name, "\n black\n")
|
86
|
+
assert_equal "<< 2632 Brown St >>", User.cleanse_attribute(:address1, "2632 Brown St \n")
|
87
|
+
assert_equal "<< instance >>", User.cleanse_attribute(:instance_var, "\n instance\n\t ")
|
88
|
+
assert_equal 12_345, User.cleanse_attribute(:zip_code, "\n\tblah 12345badtext\n")
|
90
89
|
end
|
91
90
|
|
92
91
|
describe "with user" do
|
93
92
|
before do
|
94
93
|
@user = User.new(
|
95
|
-
:
|
96
|
-
:
|
97
|
-
:
|
98
|
-
:
|
99
|
-
:
|
94
|
+
first_name: " joe ",
|
95
|
+
last_name: "\n black\n",
|
96
|
+
address1: "2632 Brown St \n",
|
97
|
+
zip_code: "\n\tblah 12345badtext\n",
|
98
|
+
instance_var: "\n instance\n\t "
|
100
99
|
)
|
101
100
|
end
|
102
101
|
|
103
|
-
it
|
102
|
+
it "only have 3 cleaners" do
|
104
103
|
assert_equal 3, User.send(:data_cleansing_cleaners).size, User.send(:data_cleansing_cleaners)
|
105
104
|
end
|
106
105
|
|
107
|
-
it
|
106
|
+
it "cleanse_attributes! using global cleaner" do
|
108
107
|
assert_equal true, @user.valid?
|
109
|
-
assert_equal
|
110
|
-
assert_equal
|
108
|
+
assert_equal "joe", @user.first_name
|
109
|
+
assert_equal "black", @user.last_name
|
111
110
|
end
|
112
111
|
|
113
|
-
it
|
112
|
+
it "cleanse_attributes! using attribute specific custom cleaner" do
|
114
113
|
assert_equal true, @user.valid?
|
115
|
-
assert_equal
|
116
|
-
assert_equal
|
114
|
+
assert_equal "<< 2632 Brown St >>", @user.address1
|
115
|
+
assert_equal "<< instance >>", @user.instance_var
|
117
116
|
end
|
118
117
|
|
119
|
-
it
|
118
|
+
it "cleanse_attributes! using global cleaner using rails extensions" do
|
120
119
|
@user.cleanse_attributes!
|
121
|
-
assert_equal
|
120
|
+
assert_equal 12_345, @user.zip_code
|
122
121
|
end
|
123
122
|
end
|
124
123
|
|
125
|
-
describe
|
124
|
+
describe "with user2" do
|
126
125
|
before do
|
127
126
|
@user = User2.new(
|
128
|
-
:
|
129
|
-
:
|
130
|
-
:
|
131
|
-
:
|
132
|
-
:
|
133
|
-
:
|
127
|
+
first_name: " joe ",
|
128
|
+
last_name: "\n black\n",
|
129
|
+
ssn: "\n 123456789 \n ",
|
130
|
+
address1: "2632 Brown St \n",
|
131
|
+
zip_code: "\n\t blah\n",
|
132
|
+
text: ["\n 123456789 \n ", " second "]
|
134
133
|
)
|
135
134
|
end
|
136
135
|
|
137
|
-
it
|
136
|
+
it "have 4 cleaners defined" do
|
138
137
|
assert_equal 4, User2.send(:data_cleansing_cleaners).size, User2.send(:data_cleansing_cleaners)
|
139
138
|
end
|
140
139
|
|
141
|
-
it
|
140
|
+
it "have 3 attributes cleaners defined" do
|
142
141
|
# :all, :first_name, :zip_code
|
143
142
|
assert_equal 3, User2.send(:data_cleansing_attribute_cleaners).size, User2.send(:data_cleansing_attribute_cleaners)
|
144
143
|
end
|
145
144
|
|
146
|
-
it
|
145
|
+
it "cleanse_attributes! clean all attributes" do
|
147
146
|
assert_equal true, @user.valid?
|
148
|
-
assert_equal
|
149
|
-
assert_equal
|
147
|
+
assert_equal "$<< @joe@ >>$", @user.first_name, User2.send(:data_cleansing_cleaners)
|
148
|
+
assert_equal "@black@", @user.last_name
|
150
149
|
assert_equal "2632 Brown St \n", @user.address1
|
151
150
|
assert_equal "@123456789@", @user.ssn
|
152
|
-
|
153
|
-
assert_equal ["\n 123456789 \n ",
|
151
|
+
assert_nil @user.zip_code, User2.send(:data_cleansing_cleaners)
|
152
|
+
assert_equal ["\n 123456789 \n ", " second "], @user.text
|
154
153
|
end
|
155
|
-
|
156
154
|
end
|
157
|
-
|
158
155
|
end
|
159
156
|
end
|
data/test/cleaners_test.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
require_relative
|
2
|
-
require
|
1
|
+
require_relative "test_helper"
|
2
|
+
require "active_support/core_ext/time/calculations"
|
3
3
|
|
4
4
|
class CleanersTest < Minitest::Test
|
5
5
|
class User
|
6
6
|
include DataCleansing::Cleanse
|
7
7
|
|
8
8
|
attr_accessor :first_name, :last_name, :address1, :address2,
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
:make_this_upper, :clean_non_word, :clean_non_printable,
|
10
|
+
:clean_html, :clean_from_uri, :clean_to_uri, :clean_whitespace,
|
11
|
+
:clean_digits_only, :clean_to_integer, :clean_to_float, :clean_end_of_day,
|
12
|
+
:clean_order
|
13
13
|
|
14
14
|
cleanse :first_name, :last_name, :address1, :address2, cleaner: :strip
|
15
15
|
cleanse :make_this_upper, cleaner: :upcase
|
@@ -25,197 +25,196 @@ class CleanersTest < Minitest::Test
|
|
25
25
|
cleanse :clean_end_of_day, cleaner: :end_of_day
|
26
26
|
|
27
27
|
# Call cleaners in the order they are defined
|
28
|
-
cleanse :clean_order, cleaner: [
|
29
|
-
cleanse :clean_order, cleaner: ->
|
28
|
+
cleanse :clean_order, cleaner: %i[upcase strip]
|
29
|
+
cleanse :clean_order, cleaner: ->(val) { val == "BLAH" ? " yes " : " no " }
|
30
30
|
end
|
31
31
|
|
32
|
-
describe
|
33
|
-
it
|
32
|
+
describe "Cleaners" do
|
33
|
+
it "#strip" do
|
34
34
|
user = User.new
|
35
|
-
user.first_name =
|
35
|
+
user.first_name = " jack black "
|
36
36
|
user.last_name = " \n \t joe"
|
37
37
|
user.address1 = "joe \n\n \n \t\t "
|
38
38
|
user.address2 = "joe \n\n bloggs \n \t\t "
|
39
39
|
user.cleanse_attributes!
|
40
|
-
assert_equal
|
41
|
-
assert_equal
|
42
|
-
assert_equal
|
40
|
+
assert_equal "jack black", user.first_name
|
41
|
+
assert_equal "joe", user.last_name
|
42
|
+
assert_equal "joe", user.address1
|
43
43
|
assert_equal "joe \n\n bloggs", user.address2
|
44
44
|
end
|
45
45
|
|
46
|
-
it
|
46
|
+
it "#upcase" do
|
47
47
|
user = User.new
|
48
|
-
user.make_this_upper =
|
48
|
+
user.make_this_upper = " jacK blAck "
|
49
49
|
user.cleanse_attributes!
|
50
|
-
assert_equal
|
50
|
+
assert_equal " JACK BLACK ", user.make_this_upper
|
51
51
|
end
|
52
52
|
|
53
|
-
it
|
53
|
+
it "#remove_non_word" do
|
54
54
|
user = User.new
|
55
55
|
user.clean_non_word = " !@#$%^&*()+=-~`\t\n jacK blAck <>.,/\"':;{][]\|?/\\ "
|
56
56
|
user.cleanse_attributes!
|
57
|
-
assert_equal
|
57
|
+
assert_equal "jacKblAck", user.clean_non_word
|
58
58
|
end
|
59
59
|
|
60
|
-
it
|
60
|
+
it "#remove_non_printable" do
|
61
61
|
user = User.new
|
62
|
-
user.clean_non_printable = " !@#$%^&*()+=-~`\t\n jacK blAck <>.,/\"':;{][]\|?/\\
|
62
|
+
user.clean_non_printable = " !@#$%^&*()+=-~`\t\n jacK blAck <>.,/\"':;{][]\|?/\\ \x89 "
|
63
63
|
user.cleanse_attributes!
|
64
64
|
assert_equal " !@#$%^&*()+=-~` jacK blAck <>.,/\"':;{][]\|?/\\ ", user.clean_non_printable
|
65
65
|
end
|
66
66
|
|
67
|
-
describe
|
68
|
-
it
|
67
|
+
describe "#clean_html" do
|
68
|
+
it "cleans "" do
|
69
69
|
user = User.new
|
70
|
-
user.clean_html =
|
70
|
+
user.clean_html = "O"Leary"
|
71
71
|
user.cleanse_attributes!
|
72
72
|
assert_equal 'O"Leary', user.clean_html
|
73
73
|
end
|
74
74
|
|
75
|
-
it
|
75
|
+
it "cleans &" do
|
76
76
|
user = User.new
|
77
|
-
user.clean_html =
|
77
|
+
user.clean_html = "Jim & Candi"
|
78
78
|
user.cleanse_attributes!
|
79
|
-
assert_equal
|
79
|
+
assert_equal "Jim & Candi", user.clean_html
|
80
80
|
end
|
81
81
|
|
82
|
-
it
|
82
|
+
it "cleans >" do
|
83
83
|
user = User.new
|
84
|
-
user.clean_html =
|
84
|
+
user.clean_html = "2 > 1"
|
85
85
|
user.cleanse_attributes!
|
86
|
-
assert_equal
|
86
|
+
assert_equal "2 > 1", user.clean_html
|
87
87
|
end
|
88
88
|
|
89
|
-
it
|
89
|
+
it "cleans <" do
|
90
90
|
user = User.new
|
91
|
-
user.clean_html =
|
91
|
+
user.clean_html = "1 < 2"
|
92
92
|
user.cleanse_attributes!
|
93
|
-
assert_equal
|
93
|
+
assert_equal "1 < 2", user.clean_html
|
94
94
|
end
|
95
95
|
|
96
|
-
it
|
96
|
+
it "cleans '" do
|
97
97
|
user = User.new
|
98
|
-
user.clean_html =
|
98
|
+
user.clean_html = "1'2"
|
99
99
|
user.cleanse_attributes!
|
100
100
|
assert_equal "1'2", user.clean_html
|
101
101
|
end
|
102
102
|
|
103
|
-
it
|
103
|
+
it "cleans " do
|
104
104
|
user = User.new
|
105
|
-
user.clean_html =
|
105
|
+
user.clean_html = "1 2"
|
106
106
|
user.cleanse_attributes!
|
107
107
|
assert_equal "1 2", user.clean_html
|
108
108
|
end
|
109
109
|
|
110
|
-
it
|
110
|
+
it "cleans &" do
|
111
111
|
user = User.new
|
112
|
-
user.clean_html =
|
112
|
+
user.clean_html = "Mutt & Jeff Inc."
|
113
113
|
user.cleanse_attributes!
|
114
|
-
assert_equal
|
114
|
+
assert_equal "Mutt & Jeff Inc.", user.clean_html
|
115
115
|
end
|
116
116
|
|
117
|
-
it
|
117
|
+
it "does not clean &;" do
|
118
118
|
user = User.new
|
119
|
-
user.clean_html =
|
119
|
+
user.clean_html = "Mutt &; Jeff Inc."
|
120
120
|
user.cleanse_attributes!
|
121
|
-
assert_equal
|
121
|
+
assert_equal "Mutt &; Jeff Inc.", user.clean_html
|
122
122
|
end
|
123
123
|
|
124
|
-
it
|
124
|
+
it "does not clean &blah;" do
|
125
125
|
user = User.new
|
126
|
-
user.clean_html =
|
126
|
+
user.clean_html = "1&blah;2"
|
127
127
|
user.cleanse_attributes!
|
128
|
-
assert_equal
|
128
|
+
assert_equal "1&blah;2", user.clean_html
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
132
|
-
describe
|
133
|
-
it
|
132
|
+
describe "#unescape_uri" do
|
133
|
+
it "converts %20" do
|
134
134
|
user = User.new
|
135
|
-
user.clean_from_uri =
|
135
|
+
user.clean_from_uri = "Jim%20%20Bob%20"
|
136
136
|
user.cleanse_attributes!
|
137
|
-
assert_equal
|
137
|
+
assert_equal "Jim Bob ", user.clean_from_uri
|
138
138
|
end
|
139
|
-
it
|
139
|
+
it "converts %20 only" do
|
140
140
|
user = User.new
|
141
|
-
user.clean_from_uri =
|
141
|
+
user.clean_from_uri = "%20"
|
142
142
|
user.cleanse_attributes!
|
143
|
-
assert_equal
|
143
|
+
assert_equal " ", user.clean_from_uri
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
147
|
-
describe
|
148
|
-
it
|
147
|
+
describe "#escape_uri" do
|
148
|
+
it "converts spaces" do
|
149
149
|
user = User.new
|
150
|
-
user.clean_to_uri =
|
150
|
+
user.clean_to_uri = "Jim Bob "
|
151
151
|
user.cleanse_attributes!
|
152
|
-
assert_equal
|
152
|
+
assert_equal "Jim++Bob+", user.clean_to_uri
|
153
153
|
end
|
154
|
-
it
|
154
|
+
it "converts space only" do
|
155
155
|
user = User.new
|
156
|
-
user.clean_to_uri =
|
156
|
+
user.clean_to_uri = " "
|
157
157
|
user.cleanse_attributes!
|
158
|
-
assert_equal
|
158
|
+
assert_equal "+", user.clean_to_uri
|
159
159
|
end
|
160
160
|
end
|
161
161
|
|
162
|
-
describe
|
163
|
-
it
|
162
|
+
describe "#compress_whitespace" do
|
163
|
+
it "compresses multiple spaces" do
|
164
164
|
user = User.new
|
165
|
-
user.clean_whitespace =
|
165
|
+
user.clean_whitespace = " J im B ob "
|
166
166
|
user.cleanse_attributes!
|
167
|
-
assert_equal
|
167
|
+
assert_equal " J im B ob ", user.clean_whitespace
|
168
168
|
end
|
169
169
|
|
170
|
-
it
|
170
|
+
it "does not compress single spaces" do
|
171
171
|
user = User.new
|
172
|
-
user.clean_whitespace =
|
172
|
+
user.clean_whitespace = " Jack Black"
|
173
173
|
user.cleanse_attributes!
|
174
|
-
assert_equal
|
174
|
+
assert_equal " Jack Black", user.clean_whitespace
|
175
175
|
end
|
176
176
|
|
177
|
-
it
|
177
|
+
it "compresses newlines and tabs" do
|
178
178
|
user = User.new
|
179
179
|
user.clean_whitespace = " \n\n J im B ob \t\n\t "
|
180
180
|
user.cleanse_attributes!
|
181
|
-
assert_equal
|
181
|
+
assert_equal " J im B ob ", user.clean_whitespace
|
182
182
|
end
|
183
183
|
end
|
184
184
|
|
185
|
-
it
|
185
|
+
it "#digits_only" do
|
186
186
|
user = User.new
|
187
187
|
user.clean_digits_only = " 1 !@#$%^&*3()+=-~`\t\n jacK6 blAck <>.,/\"':;8{][]9\|?/\\ "
|
188
188
|
user.cleanse_attributes!
|
189
|
-
assert_equal
|
189
|
+
assert_equal "13689", user.clean_digits_only
|
190
190
|
end
|
191
191
|
|
192
|
-
it
|
192
|
+
it "#string_to_integer" do
|
193
193
|
user = User.new
|
194
194
|
user.clean_to_integer = " 1 !@#$%^&*3()+=-~`\t\n jacK6 blAck <>.,/\"':;8{][]9\|?/\\ "
|
195
195
|
user.cleanse_attributes!
|
196
196
|
assert_equal 136, user.clean_to_integer
|
197
197
|
end
|
198
198
|
|
199
|
-
it
|
199
|
+
it "#string_to_float" do
|
200
200
|
user = User.new
|
201
201
|
user.clean_to_float = " 1 !@#$%^&*3()+=-~`\t\n jacK6 blAck <>.,/\"':;8{][]9\|?/\\ "
|
202
202
|
user.cleanse_attributes!
|
203
203
|
assert_equal 136.89, user.clean_to_float
|
204
204
|
end
|
205
205
|
|
206
|
-
it
|
206
|
+
it "#date_to_time_at_end_of_day" do
|
207
207
|
user = User.new
|
208
|
-
user.clean_end_of_day = Time.parse(
|
208
|
+
user.clean_end_of_day = Time.parse("2016-03-03 14:33:44 +0000")
|
209
209
|
user.cleanse_attributes!
|
210
|
-
assert_equal Time.parse(
|
210
|
+
assert_equal Time.parse("2016-03-03 23:59:59 +0000").to_i, user.clean_end_of_day.to_i
|
211
211
|
end
|
212
212
|
|
213
|
-
it
|
213
|
+
it "cleans in the order defined" do
|
214
214
|
user = User.new
|
215
|
-
user.clean_order =
|
215
|
+
user.clean_order = " blah "
|
216
216
|
user.cleanse_attributes!
|
217
|
-
assert_equal
|
217
|
+
assert_equal " yes ", user.clean_order
|
218
218
|
end
|
219
|
-
|
220
219
|
end
|
221
220
|
end
|
data/test/data_cleansing_test.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
require_relative
|
1
|
+
require_relative "test_helper"
|
2
2
|
|
3
3
|
class DataCleansingTest < Minitest::Test
|
4
|
-
describe
|
5
|
-
it
|
6
|
-
assert_equal
|
4
|
+
describe "#clean" do
|
5
|
+
it "can call any cleaner directly" do
|
6
|
+
assert_equal "jack black", DataCleansing.clean(:strip, " jack black ")
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
data/test/ruby_test.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require_relative
|
1
|
+
require_relative "test_helper"
|
2
2
|
|
3
3
|
# Non Cleansing base class
|
4
4
|
class RubyUserBase
|
@@ -11,10 +11,10 @@ class RubyUser < RubyUserBase
|
|
11
11
|
attr_accessor :first_name, :last_name, :address1, :address2
|
12
12
|
|
13
13
|
# Use a global cleaner
|
14
|
-
cleanse :first_name, :last_name, :
|
14
|
+
cleanse :first_name, :last_name, cleaner: :strip
|
15
15
|
|
16
16
|
# Define a once off cleaner
|
17
|
-
cleanse :address1, :address2, :
|
17
|
+
cleanse :address1, :address2, cleaner: proc { |string| "<< #{string.strip} >>" }
|
18
18
|
|
19
19
|
# Execute after cleanser
|
20
20
|
after_cleanse :name_check
|
@@ -31,7 +31,8 @@ end
|
|
31
31
|
|
32
32
|
class RubyUserChild < RubyUser
|
33
33
|
attr_accessor :gender
|
34
|
-
|
34
|
+
|
35
|
+
cleanse :gender, cleaner: proc { |gender| gender.to_s.strip.downcase }
|
35
36
|
end
|
36
37
|
|
37
38
|
class RubyUser2
|
@@ -40,20 +41,20 @@ class RubyUser2
|
|
40
41
|
attr_accessor :first_name, :last_name, :title, :address1, :address2, :gender
|
41
42
|
|
42
43
|
# Use a global cleaner
|
43
|
-
cleanse :first_name, :last_name, :
|
44
|
+
cleanse :first_name, :last_name, cleaner: :strip
|
44
45
|
|
45
46
|
# Define a once off cleaner
|
46
|
-
cleanse :address1, :address2, :
|
47
|
+
cleanse :address1, :address2, cleaner: proc { |string| string.strip }
|
47
48
|
|
48
49
|
# Use multiple cleaners, and a custom block
|
49
|
-
cleanse :title, :
|
50
|
+
cleanse :title, cleaner: [:strip, :upcase, proc { |string| "#{string}." unless string.end_with?(".") }]
|
50
51
|
|
51
52
|
# Change the cleansing rule based on the value of other attributes in that instance of user
|
52
53
|
# The 'title' is retrieved from the current instance of the user
|
53
|
-
cleanse :gender, :
|
54
|
+
cleanse :gender, cleaner: [
|
54
55
|
:strip,
|
55
56
|
:upcase,
|
56
|
-
|
57
|
+
proc do |gender|
|
57
58
|
if (gender == "UNKNOWN") && (title == "MR.")
|
58
59
|
"Male"
|
59
60
|
else
|
@@ -65,113 +66,110 @@ end
|
|
65
66
|
|
66
67
|
class RubyTest < Minitest::Test
|
67
68
|
describe "Ruby Models" do
|
68
|
-
|
69
|
-
it 'have globally registered cleaner' do
|
69
|
+
it "have globally registered cleaner" do
|
70
70
|
assert DataCleansing.cleaner(:strip)
|
71
71
|
end
|
72
72
|
|
73
|
-
it
|
74
|
-
assert_equal
|
75
|
-
assert_equal
|
76
|
-
assert_equal
|
77
|
-
assert_equal
|
73
|
+
it "Model.cleanse_attribute" do
|
74
|
+
assert_equal "male", RubyUserChild.cleanse_attribute(:gender, "\n Male \n"), RubyUserChild.send(:data_cleansing_attribute_cleaners)
|
75
|
+
assert_equal "joe", RubyUserChild.cleanse_attribute(:first_name, " joe "), RubyUserChild.send(:data_cleansing_attribute_cleaners)
|
76
|
+
assert_equal "black", RubyUserChild.cleanse_attribute(:last_name, "\n black\n"), RubyUserChild.send(:data_cleansing_attribute_cleaners)
|
77
|
+
assert_equal "<< 2632 Brown St >>", RubyUserChild.cleanse_attribute(:address1, "2632 Brown St \n"), RubyUserChild.send(:data_cleansing_attribute_cleaners)
|
78
78
|
assert_equal 3, RubyUserChild.cleanse_attribute(:first_name, 3), RubyUserChild.send(:data_cleansing_attribute_cleaners)
|
79
79
|
end
|
80
80
|
|
81
81
|
describe "with ruby user" do
|
82
82
|
before do
|
83
83
|
@user = RubyUser.new
|
84
|
-
@user.first_name =
|
84
|
+
@user.first_name = " joe "
|
85
85
|
@user.last_name = "\n black\n"
|
86
86
|
@user.address1 = "2632 Brown St \n"
|
87
87
|
end
|
88
88
|
|
89
|
-
it
|
89
|
+
it "cleanse_attributes! using global cleaner" do
|
90
90
|
@user.cleanse_attributes!
|
91
|
-
assert_equal
|
92
|
-
assert_equal
|
91
|
+
assert_equal "joe", @user.first_name
|
92
|
+
assert_equal "black", @user.last_name
|
93
93
|
end
|
94
94
|
|
95
|
-
it
|
95
|
+
it "cleanse_attributes! using attribute specific custom cleaner" do
|
96
96
|
@user.cleanse_attributes!
|
97
|
-
assert_equal
|
97
|
+
assert_equal "<< 2632 Brown St >>", @user.address1
|
98
98
|
end
|
99
99
|
|
100
|
-
it
|
100
|
+
it "cleanse_attributes! not cleanse nil attributes" do
|
101
101
|
@user.first_name = nil
|
102
102
|
@user.cleanse_attributes!
|
103
|
-
|
103
|
+
assert_nil @user.first_name
|
104
104
|
end
|
105
105
|
|
106
|
-
it
|
107
|
-
@user.first_name =
|
106
|
+
it "cleanse_attributes! call after cleaner" do
|
107
|
+
@user.first_name = "Jack"
|
108
108
|
@user.last_name = nil
|
109
109
|
@user.cleanse_attributes!
|
110
|
-
|
111
|
-
assert_equal
|
110
|
+
assert_nil @user.first_name, @user.inspect
|
111
|
+
assert_equal "Jack", @user.last_name, @user.inspect
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
115
115
|
describe "with ruby user child" do
|
116
116
|
before do
|
117
117
|
@user = RubyUserChild.new
|
118
|
-
@user.first_name =
|
118
|
+
@user.first_name = " joe "
|
119
119
|
@user.last_name = "\n black\n"
|
120
120
|
@user.address1 = "2632 Brown St \n"
|
121
121
|
@user.gender = "\n Male \n"
|
122
122
|
end
|
123
123
|
|
124
|
-
it
|
124
|
+
it "cleanse_attributes! using global cleaner" do
|
125
125
|
@user.cleanse_attributes!
|
126
|
-
assert_equal
|
127
|
-
assert_equal
|
126
|
+
assert_equal "joe", @user.first_name
|
127
|
+
assert_equal "black", @user.last_name
|
128
128
|
end
|
129
129
|
|
130
|
-
it
|
130
|
+
it "cleanse_attributes! using attribute specific custom cleaner" do
|
131
131
|
@user.cleanse_attributes!
|
132
|
-
assert_equal
|
132
|
+
assert_equal "<< 2632 Brown St >>", @user.address1
|
133
133
|
end
|
134
134
|
|
135
|
-
it
|
135
|
+
it "cleanse_attributes! not cleanse nil attributes" do
|
136
136
|
@user.first_name = nil
|
137
137
|
@user.cleanse_attributes!
|
138
|
-
|
138
|
+
assert_nil @user.first_name
|
139
139
|
end
|
140
140
|
|
141
|
-
it
|
141
|
+
it "cleanse_attributes! clean child attributes" do
|
142
142
|
@user.cleanse_attributes!
|
143
|
-
assert_equal
|
143
|
+
assert_equal "male", @user.gender
|
144
144
|
end
|
145
|
-
|
146
145
|
end
|
147
146
|
|
148
147
|
describe "with ruby user2" do
|
149
148
|
before do
|
150
149
|
@user = RubyUser2.new
|
151
|
-
@user.first_name =
|
150
|
+
@user.first_name = " joe "
|
152
151
|
@user.last_name = "\n black\n"
|
153
152
|
@user.address1 = "2632 Brown St \n"
|
154
153
|
@user.title = " \nmr \n"
|
155
154
|
@user.gender = " Unknown "
|
156
155
|
end
|
157
156
|
|
158
|
-
it
|
157
|
+
it "cleanse_attributes!" do
|
159
158
|
@user.cleanse_attributes!
|
160
|
-
assert_equal
|
161
|
-
assert_equal
|
162
|
-
assert_equal
|
159
|
+
assert_equal "joe", @user.first_name
|
160
|
+
assert_equal "black", @user.last_name
|
161
|
+
assert_equal "2632 Brown St", @user.address1
|
163
162
|
end
|
164
163
|
|
165
|
-
it
|
164
|
+
it "cleanse_attributes! with multiple cleaners" do
|
166
165
|
@user.cleanse_attributes!
|
167
|
-
assert_equal
|
166
|
+
assert_equal "MR.", @user.title
|
168
167
|
end
|
169
168
|
|
170
|
-
it
|
169
|
+
it "cleanse_attributes! referencing other attributes" do
|
171
170
|
@user.cleanse_attributes!
|
172
|
-
assert_equal
|
171
|
+
assert_equal "Male", @user.gender
|
173
172
|
end
|
174
173
|
end
|
175
|
-
|
176
174
|
end
|
177
175
|
end
|
data/test/test_db.sqlite3
CHANGED
Binary file
|
data/test/test_helper.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
ENV[
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
3
|
+
require "active_record"
|
4
|
+
require "minitest/autorun"
|
5
|
+
require "data_cleansing"
|
6
|
+
require "amazing_print"
|
7
7
|
|
8
|
-
SemanticLogger.add_appender(file_name:
|
8
|
+
SemanticLogger.add_appender(file_name: "test.log", formatter: :color)
|
9
9
|
SemanticLogger.default_level = :debug
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data_cleansing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reid Morrison
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -38,9 +38,8 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.0'
|
41
|
-
description:
|
41
|
+
description:
|
42
42
|
email:
|
43
|
-
- reidmo@gmail.com
|
44
43
|
executables: []
|
45
44
|
extensions: []
|
46
45
|
extra_rdoc_files: []
|
@@ -64,7 +63,7 @@ homepage: http://github.com/reidmorrison/data_cleansing
|
|
64
63
|
licenses:
|
65
64
|
- Apache-2.0
|
66
65
|
metadata: {}
|
67
|
-
post_install_message:
|
66
|
+
post_install_message:
|
68
67
|
rdoc_options: []
|
69
68
|
require_paths:
|
70
69
|
- lib
|
@@ -72,21 +71,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
72
71
|
requirements:
|
73
72
|
- - ">="
|
74
73
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
74
|
+
version: '2.3'
|
76
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
76
|
requirements:
|
78
77
|
- - ">="
|
79
78
|
- !ruby/object:Gem::Version
|
80
79
|
version: '0'
|
81
80
|
requirements: []
|
82
|
-
rubygems_version: 3.
|
83
|
-
signing_key:
|
81
|
+
rubygems_version: 3.2.22
|
82
|
+
signing_key:
|
84
83
|
specification_version: 4
|
85
84
|
summary: Data Cleansing framework for Ruby, Rails, and Mongoid.
|
86
85
|
test_files:
|
87
|
-
- test/test_db.sqlite3
|
88
|
-
- test/data_cleansing_test.rb
|
89
86
|
- test/active_record_test.rb
|
87
|
+
- test/cleaners_test.rb
|
88
|
+
- test/data_cleansing_test.rb
|
90
89
|
- test/ruby_test.rb
|
90
|
+
- test/test_db.sqlite3
|
91
91
|
- test/test_helper.rb
|
92
|
-
- test/cleaners_test.rb
|