effective_developer 0.8.4 → 0.8.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8fba16ab5113f2da3b2868adf4bf3637728a1fa014ee77f3145e20662f7388dc
4
- data.tar.gz: b178128f65a9ac17b175e4346289fba89c5bbead7d7102d6af33ac84f9cbf012
3
+ metadata.gz: 19ed54abb37c597e55d1b45aef357c4174881f79243d25edaf7ab0d540c121a1
4
+ data.tar.gz: 1179ac079bd24741a518040211600f84f68965e48f230920e1d5812d2ba6d98e
5
5
  SHA512:
6
- metadata.gz: c204417a800c42f41e313ee4c4af7301988224baf9ccce225f1a8bdb12cf519bd6c52003a5636c9461a8045f5e27f1ad4f3f6a1b21278913d60109d6a86d2b80
7
- data.tar.gz: e7238d4b8592aab380b80dfcb9fc82c2a45e9be0534c9cfc5f13258135df6d9c7fb5ce6e60edcf4329d8682c6ec0d99711fb381cefee9e3fed0e3f68cfd63c1b
6
+ metadata.gz: 31ffc32f164d5c76772dce297f257a8e11b397b565b4cf201b9df3d642d107e1f61352f73b8724954ee7834639529bcbc3f28c549f155bfac196073800564e40
7
+ data.tar.gz: ff8a97d65972d97b2ad5418217c827511e5342915d2b4df6ef73cb1c7a2f49503c51dda34d397d8f56124089d52b1dff5b055036c95f78a31312d81f3eafd438
@@ -16,11 +16,14 @@ module Effective
16
16
  def replace!(old_value, new_value)
17
17
  raise("old_value cannot contain a \' character") if old_value.include?("'")
18
18
  raise("new_value cannot contain a \' character") if new_value.include?("'")
19
+
20
+ total = 0
19
21
 
20
22
  places.each do |table, columns|
21
23
  columns.each do |column|
22
24
  sql = "SELECT COUNT(*) FROM #{table} WHERE #{column} ILIKE '%#{old_value}%'"
23
25
  existing = ActiveRecord::Base.connection.execute(sql).first['count'].to_i
26
+ total += existing
24
27
 
25
28
  puts "Replacing #{existing} occurrences of #{old_value} with #{new_value} in #{table}.#{column}"
26
29
 
@@ -28,22 +31,28 @@ module Effective
28
31
  ActiveRecord::Base.connection.execute(sql)
29
32
  end
30
33
  end
31
-
32
- true
34
+
35
+ total
33
36
  end
34
37
 
35
38
  def count(old_value)
36
39
  raise("old_value cannot contain a \' character") if old_value.include?("'")
37
40
 
41
+ total = 0
42
+
38
43
  places.each do |table, columns|
39
44
  columns.each do |column|
40
45
  sql = "SELECT COUNT(*) FROM #{table} WHERE #{column} ILIKE '%#{old_value}%'"
41
46
  existing = ActiveRecord::Base.connection.execute(sql).first['count'].to_i
47
+ total += existing
42
48
 
43
49
  puts "There are #{existing} occurrences of #{old_value} in #{table}.#{column}"
44
50
  end
45
51
  end
52
+
53
+ total
46
54
  end
55
+ alias_method :find, :count
47
56
 
48
57
  end
49
58
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveDeveloper
2
- VERSION = '0.8.4'.freeze
2
+ VERSION = '0.8.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_developer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.4
4
+ version: 0.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect