data_cleansing 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/data_cleansing/cleanse.rb +1 -1
- data/lib/data_cleansing/data_cleansing.rb +4 -4
- data/lib/data_cleansing/version.rb +1 -1
- data/test/test_db.sqlite3 +0 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 914884e96f6e9bee2e9cc733b6a3b0d842c63372
|
4
|
+
data.tar.gz: 7aeb9ee62b16c4ffed8b938169bc2fe45166519e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ada2dac60031d67bca712b593d4e875c47e70ae5b40d9279dc075d6b19bec06f832cdc7f214d8b1d8b200a2e2d86c9b860e2e117e91ee0c8f4c092b14d8d11a
|
7
|
+
data.tar.gz: 459703e92b0b344fe230282920480e356478fb07cec692b1c0b36387eee809edd41a5fe5b1e2d7ddd1b10d91adbf1186b81ed35d852c5a6eb8a1378ac2773eb8
|
@@ -103,7 +103,7 @@ module DataCleansing
|
|
103
103
|
# Duplicate value in case cleaner uses methods such as gsub!
|
104
104
|
new_value = value.is_a?(String) ? value.dup : value
|
105
105
|
cleaner_struct.cleaners.each do |name|
|
106
|
-
new_value = DataCleansing.clean(name, new_value, binding)
|
106
|
+
new_value = DataCleansing.clean(name, new_value, cleaner_struct.params, binding)
|
107
107
|
end
|
108
108
|
new_value
|
109
109
|
end
|
@@ -28,7 +28,7 @@ module DataCleansing
|
|
28
28
|
end
|
29
29
|
|
30
30
|
# Run the specified cleanser against the supplied value
|
31
|
-
def self.clean(name, value, binding = nil)
|
31
|
+
def self.clean(name, value, params = nil, binding = nil)
|
32
32
|
# Cleaner itself could be a custom Proc, otherwise do a global lookup for it
|
33
33
|
proc = name.is_a?(Proc) ? name : DataCleansing.cleaner(name.to_sym)
|
34
34
|
raise(ArgumentError, "No cleaner defined for #{name.inspect}") unless proc
|
@@ -36,12 +36,12 @@ module DataCleansing
|
|
36
36
|
if proc.is_a?(Proc)
|
37
37
|
if binding
|
38
38
|
# Call the cleaner proc within the scope (binding) of the binding
|
39
|
-
proc.arity == 1 ? binding.instance_exec(value, &proc) : binding.instance_exec(value,
|
39
|
+
proc.arity == 1 ? binding.instance_exec(value, &proc) : binding.instance_exec(value, params, &proc)
|
40
40
|
else
|
41
|
-
proc.arity == 1 ? proc.call(value) : proc.call(value,
|
41
|
+
proc.arity == 1 ? proc.call(value) : proc.call(value, params)
|
42
42
|
end
|
43
43
|
else
|
44
|
-
(proc.method(:call).arity == 1 ? proc.call(value) : proc.call(value,
|
44
|
+
(proc.method(:call).arity == 1 ? proc.call(value) : proc.call(value, params))
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
data/test/test_db.sqlite3
CHANGED
Binary file
|