core-state 0.1.4 → 0.1.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: 7c21289439e5a70015dc1fad5f146ce0742296965b142b7e1a358195a4eeae7e
4
- data.tar.gz: c02f0889fd523fcb34c865b2dd3232a2bd2bce51c0211bff5f21c14aef848daa
3
+ metadata.gz: db495761cd564d756fb99e985b29d4e8176c532d605724a321670cfa8888e4b9
4
+ data.tar.gz: 96f7b2337e73e82a7ea5735a98e7b6a7055b9098656248e4c658584d5eb074b7
5
5
  SHA512:
6
- metadata.gz: 753c19c8d932f869ab172136b3772e70502969ed4c702317c61de491d2fe52da8b6a6b32a1e5b00b02535e0a46bd0f3d33e62b56fa1862c7e6c2c6803fe3da84
7
- data.tar.gz: f660e4cc842ef45e30b6ee665af5a4a8aa33de9c170e3852afb8bf4c5cd5fd5cf21b028be78927761e1febd2859655a3257d50e9870345469934a9146e94a534
6
+ metadata.gz: fe3dfb3399854e9ffd96cd257b195b545cd31cda25d95db4af6be40c17890653322a015881672c75df64d4a451d4c11cf7004b90aa62cb83937d29de90d1ea9a
7
+ data.tar.gz: 229caf7f8a616ed01498420f688f6c8366663684791be54581e074836f035d52c1cd5d2123c953da2ac861bbf703984b0324fbbbd2d0b4142989cb20a4175c7d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [v0.1.5](https://github.com/metabahn/corerb/releases/tag/2021-10-22)
2
+
3
+ *released on 2021-10-22*
4
+
5
+ * `fix` [#88](https://github.com/metabahn/corerb/pull/88) Fix an issue causing state to be shared between sibling subclasses ([bryanp](https://github.com/bryanp))
6
+
1
7
  ## [v0.1.4](https://github.com/metabahn/corerb/releases/tag/2021-09-30)
2
8
 
3
9
  *released on 2021-09-30*
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Core
4
4
  module State
5
- VERSION = "0.1.4"
5
+ VERSION = "0.1.5"
6
6
 
7
7
  def self.version
8
8
  VERSION
data/lib/is/stateful.rb CHANGED
@@ -7,14 +7,12 @@ module Is
7
7
  # [public] Makes objects stateful.
8
8
  #
9
9
  module Stateful
10
- # Adding core-copy as a dependency of core-state creates a recursive dependency, so just bundle it.
10
+ # Adding core-copy as a dependency creates a recursive dependency, so just bundle it.
11
11
  #
12
12
  module Copy
13
13
  DEFAULT = ::Object.new
14
14
 
15
15
  refine ::Object do
16
- # [public] Copies the object using `clone`.
17
- #
18
16
  if RbConfig::CONFIG["RUBY_PROGRAM_VERSION"] < "3"
19
17
  def copy(freeze: DEFAULT)
20
18
  should_freeze = resolve_freeze_argument(freeze)
@@ -40,8 +38,6 @@ module Is
40
38
  end
41
39
 
42
40
  refine Array do
43
- # [public] Copies the array, along with each value.
44
- #
45
41
  def copy(freeze: DEFAULT)
46
42
  unless Stateful.copying?(self)
47
43
  Stateful.prevent_recursion(self) do
@@ -58,8 +54,6 @@ module Is
58
54
  end
59
55
 
60
56
  refine Hash do
61
- # [public] Copies the hash, along with each key and value.
62
- #
63
57
  def copy(freeze: DEFAULT)
64
58
  unless Stateful.copying?(self)
65
59
  Stateful.prevent_recursion(self) do
@@ -192,7 +186,9 @@ module Is
192
186
  end
193
187
 
194
188
  subclass.send(:prepend_defined_state_modules)
195
- subclass.instance_variable_set("@__defined_state", @__defined_state.dup)
189
+ subclass.instance_variable_set("@__defined_state", @__defined_state.each_with_object({}) { |(key, value), state|
190
+ state[key] = value.dup
191
+ })
196
192
 
197
193
  super
198
194
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: core-state
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Powell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-01 00:00:00.000000000 Z
11
+ date: 2021-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: core-extension