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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0347620583101155e6181d7e2504ef2a4816d970
4
- data.tar.gz: b80bff6ab7116bda3cef959a7eeb6c231ab3660b
3
+ metadata.gz: 914884e96f6e9bee2e9cc733b6a3b0d842c63372
4
+ data.tar.gz: 7aeb9ee62b16c4ffed8b938169bc2fe45166519e
5
5
  SHA512:
6
- metadata.gz: 474e0ed54427a7958358a1d645d95792af3b83f0621e48c1986d09ecfd1f8288aada4e6ee55573f88347eb7193adf0eddde1b7cb39c110c6a84a1c5f43daae19
7
- data.tar.gz: deb42d04fa24cf7b3e77d8411989e2c8578bf8c23b9f8726898df640e93e271071e0cccd96850eb342780737894823ccd295032a24bb22fdc16678a71b55ddd1
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, cleaner_struct.params, &proc)
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, cleaner_struct.params)
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, cleaner_struct.params))
44
+ (proc.method(:call).arity == 1 ? proc.call(value) : proc.call(value, params))
45
45
  end
46
46
  end
47
47
 
@@ -1,3 +1,3 @@
1
1
  module DataCleansing
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
data/test/test_db.sqlite3 CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: data_cleansing
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reid Morrison