wallaby-core 0.2.2 → 0.2.5

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
  SHA256:
3
- metadata.gz: e734b411c2c25a8eb828f0a3610a868aea0da1ec3292ead6422494a7e69fe4f3
4
- data.tar.gz: 37c0db19ed98a67512706633ca4c99120de9bdd0e246ee66d91cf19c536bfa5a
3
+ metadata.gz: d0d88e52f518d36150436506a1aabb09b893bd9cfd8d63714d43885a3996d6c1
4
+ data.tar.gz: bf0b36a51ff84c21af190e403ef4cd97f7ebe3081859a92dbde1ed2dc078791d
5
5
  SHA512:
6
- metadata.gz: 80179286ff0d8c67f99d3881fec98791d436047de690a79de6b3a0df204ba8d132265111e78a00997e6d0188e1c04e36e5811aa9a9b2bcaacbb7e76492a833b5
7
- data.tar.gz: 431ca7009491c389d0b0f34862077daa4214b5f6a8c75c44b5c5291fdeec09f607452bec1700dde50bd9c8449cd3d9c7f15b47821269f2fa57d921e0a3f20f6c
6
+ metadata.gz: 6beae8bb92548901e4ef9cffd91d29c71b5357ec7b6b092439c09ca561fc67b35d950c5f3d439971dd17b8fcacbd77b6bfe6b79b533c720b3e70b5a49628a73c
7
+ data.tar.gz: 4fb24f6c6dc2a1a6efe58607e8da3fb4fcb96bc7fe359130fbf952e695c38cbd7bb7a668f1b3ed3a5b4ce235449263557b76d1739cfd67809c0f37dda266789d
data/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![Test Coverage](https://api.codeclimate.com/v1/badges/f16f8d87553424c1aacc/test_coverage)](https://codeclimate.com/github/wallaby-rails/wallaby-core/test_coverage)
8
8
  [![Inch CI](https://inch-ci.org/github/wallaby-rails/wallaby-core.svg?branch=master)](https://inch-ci.org/github/wallaby-rails/wallaby-core)
9
9
 
10
- Wallaby::Core holds all the core interfaces that [Wallaby](https://github.com/wallaby-rails/wallaby) gem is built upon.
10
+ **Wallaby::Core** holds all the core interfaces that [Wallaby](https://github.com/wallaby-rails/wallaby) gem is built upon.
11
11
 
12
12
  ## Install
13
13
 
@@ -28,6 +28,47 @@ bundle install
28
28
  - [API Reference](https://www.rubydoc.info/gems/wallaby-core)
29
29
  - [Change Logs](https://github.com/wallaby-rails/wallaby-core/blob/master/CHANGELOG.md)
30
30
 
31
+ ## Build, test and update document
32
+
33
+ To set up local development environment:
34
+
35
+ - git clone this repo
36
+ - install Ruby (2.4 ~ 3.0)
37
+ - install gems
38
+
39
+ ```shell
40
+ bundle install
41
+ ```
42
+
43
+ - install both MySQL and PostgreSQL
44
+ - create databases
45
+
46
+ ```shell
47
+ bundle exec rake db:create
48
+ ```
49
+
50
+ - start developing
51
+
52
+ Make sure to pass the following checks and tests before putting up a PR:
53
+
54
+ - rubocop analysis and format check
55
+
56
+ ```shell
57
+ bundle exec rubocop -a
58
+ ```
59
+
60
+ - rspec test suites and 100% test coverage
61
+
62
+ ```shell
63
+ RAILS_ENV=test bundle exec rake --trace spec
64
+ ```
65
+
66
+ - update the comments and build the yardoc
67
+
68
+ ```shell
69
+ yardoc
70
+ ```
71
+
31
72
  ## Want to contribute?
32
73
 
33
74
  Raise an [issue](https://github.com/wallaby-rails/wallaby-core/issues/new), discuss and resolve!
@@ -7,7 +7,22 @@ module Wallaby
7
7
  # @param object [Object]
8
8
  # @return [Object] a clone object
9
9
  def self.clone(object)
10
- ::Marshal.load(::Marshal.dump(object))
10
+ # NOTE: Neither marshal/deep_dup/dup are able to achieve 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(
15
+ object.class.new(object.default)
16
+ ) { |(key, value), hash| hash[key] = clone(value) }
17
+ when Array
18
+ object.each_with_object(object.class.new) { |value, array| array << clone(value) }
19
+ when Class
20
+ # NOTE: `Class.dup` will turn the duplicate class into anonymous class
21
+ # therefore, we just return the Class itself here
22
+ object
23
+ else
24
+ object.dup
25
+ end
11
26
  end
12
27
 
13
28
  # @param object [Object, nil]
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Wallaby
4
4
  module Core
5
- VERSION = '0.2.2' # :nodoc:
5
+ VERSION = '0.2.5' # :nodoc:
6
6
  end
7
7
  end
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.2
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tian Chen
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-11 00:00:00.000000000 Z
11
+ date: 2022-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -226,7 +226,7 @@ metadata:
226
226
  homepage_uri: https://github.com/wallaby-rails/wallaby-core
227
227
  source_code_uri: https://github.com/wallaby-rails/wallaby-core
228
228
  changelog_uri: https://github.com/wallaby-rails/wallaby-core/blob/master/CHANGELOG.md
229
- post_install_message:
229
+ post_install_message:
230
230
  rdoc_options: []
231
231
  require_paths:
232
232
  - lib
@@ -242,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
242
242
  version: '0'
243
243
  requirements: []
244
244
  rubygems_version: 3.0.3
245
- signing_key:
245
+ signing_key:
246
246
  specification_version: 4
247
247
  summary: The core of Wallaby
248
248
  test_files: []