wallaby-core 0.2.3 → 0.2.4
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/lib/utils/wallaby/utils.rb +14 -1
- data/lib/wallaby/core/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 549512f63ab75eb29715ca2842daba07744482836896ddbf8d58ee873eeda983
|
4
|
+
data.tar.gz: 7997ba9973a504145d363673a5ea222013358673601cb0304bdf6d22a74b927e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2eaff56ae4c69091a6de82f5ae4e067b65490aec8b76a54ff602b6714957e4ccf90b6ddec573032868941d5868bccde3c000ee038cb19dfe8d0cfc5fa12cf08e
|
7
|
+
data.tar.gz: 55c273983a048eb454248efe777b2abb9fb72e4a969792b3d33483b5b4944740ca1555e98fb41b25c558188420cb5a27fbd9c3aa5094786ee623fc6b81a3522f
|
data/lib/utils/wallaby/utils.rb
CHANGED
@@ -7,7 +7,20 @@ module Wallaby
|
|
7
7
|
# @param object [Object]
|
8
8
|
# @return [Object] a clone object
|
9
9
|
def self.clone(object)
|
10
|
-
|
10
|
+
# NOTE: Neither marshal/deep_dup/dup achieves real and correct deep copy,
|
11
|
+
# so here we need a custom solution below:
|
12
|
+
case object
|
13
|
+
when Hash
|
14
|
+
object.each_with_object(object.class.new) { |(key, value), hash| hash[key] = clone(value) }
|
15
|
+
when Array
|
16
|
+
object.each_with_object(object.class.new) { |value, array| array << clone(value) }
|
17
|
+
when Class
|
18
|
+
# NOTE: `Class.dup` will turn the duplicate class into anonymous class
|
19
|
+
# therefore, we just return the Class itself here
|
20
|
+
object
|
21
|
+
else
|
22
|
+
object.dup
|
23
|
+
end
|
11
24
|
end
|
12
25
|
|
13
26
|
# @param object [Object, nil]
|
data/lib/wallaby/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wallaby-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tian Chen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -241,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
241
241
|
- !ruby/object:Gem::Version
|
242
242
|
version: '0'
|
243
243
|
requirements: []
|
244
|
-
rubygems_version: 3.
|
244
|
+
rubygems_version: 3.1.6
|
245
245
|
signing_key:
|
246
246
|
specification_version: 4
|
247
247
|
summary: The core of Wallaby
|