rack-app 3.5.1 → 3.5.2
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/VERSION +1 -1
- data/lib/rack/app/utils/deep_dup.rb +7 -8
- 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: 8920a6343145bbc939f0dacf8c7d78e12968f3b6
|
4
|
+
data.tar.gz: a5e359df0d707b86d354ea8ad3f73dd8ddc52c84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5d792881a13efcde9273212e6f40433def1313eb3352e7b615660d301db79302fa18b59bd4504a4a3b49a985482942426b8ad8a2682dad28debccc965675343
|
7
|
+
data.tar.gz: f80bbd2fb7b8c0c90be59fb073f4d9192f2f28518a1eb13476dbe9b49036afa8a50752b756553fe0b0a015da2d80730a5e8ea1cec439c701828657c1267bfca9
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.5.
|
1
|
+
3.5.2
|
@@ -11,18 +11,18 @@ module Rack::App::Utils::DeepDup
|
|
11
11
|
protected
|
12
12
|
|
13
13
|
def registered(object, register)
|
14
|
-
register[object.
|
14
|
+
register[object.__id__]
|
15
15
|
end
|
16
16
|
|
17
17
|
def register_duplication(register, object, duplicate)
|
18
|
-
register[object.
|
18
|
+
register[object.__id__]= duplicate
|
19
19
|
duplicate
|
20
20
|
end
|
21
21
|
|
22
22
|
def dup(register, object)
|
23
23
|
|
24
|
-
return object unless registrable?(object)
|
25
24
|
return registered(object, register) if registered(object, register)
|
25
|
+
return register_duplication(register, object, object) unless identifiable?(object)
|
26
26
|
|
27
27
|
case object
|
28
28
|
|
@@ -47,9 +47,8 @@ module Rack::App::Utils::DeepDup
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
def
|
51
|
-
object.
|
52
|
-
true
|
50
|
+
def identifiable?(object)
|
51
|
+
object.class && object.respond_to?(:is_a?)
|
53
52
|
rescue NoMethodError
|
54
53
|
false
|
55
54
|
end
|
@@ -105,7 +104,7 @@ module Rack::App::Utils::DeepDup
|
|
105
104
|
def set_instance_variable(duplicate, instance_variable_name, value_to_set)
|
106
105
|
duplicate.instance_variable_set(instance_variable_name, value_to_set)
|
107
106
|
rescue NoMethodError
|
108
|
-
duplicate.instance_eval("#{instance_variable_name} = Marshal.load(#{Marshal.dump(value_to_set).inspect})")
|
107
|
+
duplicate.instance_eval("#{instance_variable_name} = Marshal.load(#{Marshal.dump(value_to_set).to_s.inspect})")
|
109
108
|
end
|
110
109
|
|
111
110
|
def try_dup(object)
|
@@ -115,7 +114,7 @@ module Rack::App::Utils::DeepDup
|
|
115
114
|
end
|
116
115
|
|
117
116
|
def respond_to_instance_variables?(object)
|
118
|
-
object.respond_to?(:instance_variables)
|
117
|
+
object.respond_to?(:instance_variables) && object.instance_variables.is_a?(Array)
|
119
118
|
rescue NoMethodError
|
120
119
|
false
|
121
120
|
end
|