active_record_mysql_repl 0.1.10 → 0.1.12
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb8ee6363c8b678044b161c2226a2c8f3260797b1f6373d29ccf444149219504
|
4
|
+
data.tar.gz: 0cb27fd8dc02ce73834a56985ef10b6b6a8aafdb7bb429c399d4bd9f17c22f69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b029d35e7f40a62adccecbf47bc2a0262c4ed83386408252e79d4d05910eb45d268564ba4ffbc1ad63f0552232bf456a44fab0d6172ab03d94831a92eaeb44d6
|
7
|
+
data.tar.gz: f726cefaad6d521c3d44a5f6df61f63fec00d7ed065d8215b54afe29ec0f2196b65b27419ecb2aef8feeb137855a3dfaa902a6c079a88e3bd71f0c0909bec1bc
|
@@ -18,17 +18,15 @@ module ActiverecordMysqlRepl
|
|
18
18
|
end
|
19
19
|
|
20
20
|
arr = arr.map do |e|
|
21
|
-
if e.is_a?(::ActiveRecord::Base)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
next values
|
21
|
+
e = e.attributes if e.is_a?(::ActiveRecord::Base)
|
22
|
+
next e unless e.is_a?(Hash)
|
23
|
+
next e.transform_values do |v|
|
24
|
+
next JSON.pretty_generate(v) if v.is_a?(Enumerable) && v.size > 0
|
25
|
+
next v.to_time if v.is_a?(Time) || v.is_a?(Date)
|
26
|
+
next "NULL" if v.nil?
|
27
|
+
next '""' if v == ""
|
28
|
+
v.to_s
|
30
29
|
end
|
31
|
-
e
|
32
30
|
end
|
33
31
|
|
34
32
|
raise "#{arr} is not an array of hash".red unless arr.all? { |e| e.is_a?(Hash) }
|
@@ -79,16 +77,15 @@ module ActiverecordMysqlRepl
|
|
79
77
|
end
|
80
78
|
|
81
79
|
arr = arr.map do |e|
|
82
|
-
if e.is_a?(::ActiveRecord::Base)
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
80
|
+
e = e.attributes if e.is_a?(::ActiveRecord::Base)
|
81
|
+
next e unless e.is_a?(Hash)
|
82
|
+
next e.transform_values do |v|
|
83
|
+
next JSON.pretty_generate(v) if v.is_a?(Enumerable) && v.size > 0
|
84
|
+
next v.to_time if v.is_a?(Time) || v.is_a?(Date)
|
85
|
+
next "NULL" if v.nil?
|
86
|
+
next '""' if v == ""
|
87
|
+
v.to_s
|
90
88
|
end
|
91
|
-
e
|
92
89
|
end
|
93
90
|
|
94
91
|
raise "#{arr} is not an array of hash".red unless arr.all? { |e| e.is_a?(Hash) }
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_mysql_repl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroki Kishi
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-04-
|
10
|
+
date: 2025-04-12 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: byebug
|