core-state 0.1.0 → 0.1.1
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/CHANGELOG.md +7 -0
- data/lib/core/state/version.rb +1 -1
- data/lib/is/stateful.rb +10 -10
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e5ce4cb2ff3e96c75306c312db38fc09e9f95499d2e4d133d48093b38f64423b
|
|
4
|
+
data.tar.gz: 04a0e78d72397976690d10d37431a6765809906a5c1708a7ac504bb20bf2d329
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f03ad4241c69ef2d263741efc9ada4aecd984f8e699bf413ba503e8f0fe14174afcb6aa0a4ea602e7c39a68dbecd7da1d47418fa45c271c48dee822c78490871
|
|
7
|
+
data.tar.gz: d4b2bbd0e812133cc774b399519e109c2b32787aa20866d134f3b55b2523cee40fdff7936ee3e70a49edd3ce56a5aacde2c6298a177801c59e2ec280e66f9d6f
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [v0.1.1](https://github.com/metabahn/corerb/releases/tag/2021-07-15)
|
|
2
|
+
|
|
3
|
+
*released on 2021-07-15*
|
|
4
|
+
|
|
5
|
+
* `fix` [#62](https://github.com/metabahn/corerb/pull/62) Correctly isolate class-level state on access ([bryanp](https://github.com/bryanp))
|
|
6
|
+
* `fix` [#55](https://github.com/metabahn/corerb/pull/55) Correctly forward arguments to super initialize ([bryanp](https://github.com/bryanp))
|
|
7
|
+
|
|
1
8
|
## [v0.1.0](https://github.com/metabahn/corerb/releases/tag/2021-07-07)
|
|
2
9
|
|
|
3
10
|
*released on 2021-07-07*
|
data/lib/core/state/version.rb
CHANGED
data/lib/is/stateful.rb
CHANGED
|
@@ -14,11 +14,11 @@ module Is
|
|
|
14
14
|
|
|
15
15
|
ALLOWED_FLAGS = %i[class instance].freeze
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
applies do
|
|
18
18
|
prepend_defined_state_modules
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
extends :
|
|
21
|
+
extends :definition do
|
|
22
22
|
# [public] Defines state by name.
|
|
23
23
|
#
|
|
24
24
|
# flags - Changes how the state is defined. Possible values include:
|
|
@@ -62,9 +62,9 @@ module Is
|
|
|
62
62
|
if state[:class]
|
|
63
63
|
defined_state_class_module.module_eval <<~CODE, __FILE__, __LINE__ + 1
|
|
64
64
|
#{prefix}def #{method_name}
|
|
65
|
-
unless defined_state_isolations.include?(#{ivar_name})
|
|
65
|
+
unless defined_state_isolations.include?(#{ivar_name.inspect})
|
|
66
66
|
#{ivar_name} = #{ivar_name}.copy
|
|
67
|
-
defined_state_isolations << #{ivar_name}
|
|
67
|
+
defined_state_isolations << #{ivar_name.inspect}
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
#{ivar_name}
|
|
@@ -75,9 +75,9 @@ module Is
|
|
|
75
75
|
if state[:instance]
|
|
76
76
|
defined_state_instance_module.module_eval <<~CODE, __FILE__, __LINE__ + 1
|
|
77
77
|
#{prefix}def #{method_name}
|
|
78
|
-
unless defined_state_isolations.include?(#{ivar_name})
|
|
78
|
+
unless defined_state_isolations.include?(#{ivar_name.inspect})
|
|
79
79
|
#{ivar_name} = #{ivar_name}.copy
|
|
80
|
-
defined_state_isolations << #{ivar_name}
|
|
80
|
+
defined_state_isolations << #{ivar_name.inspect}
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
#{ivar_name}
|
|
@@ -167,8 +167,8 @@ module Is
|
|
|
167
167
|
end
|
|
168
168
|
end
|
|
169
169
|
|
|
170
|
-
extends :
|
|
171
|
-
def initialize(
|
|
170
|
+
extends :implementation, prepend: true do
|
|
171
|
+
def initialize(...)
|
|
172
172
|
self.class.send(:defined_state).each_pair do |name, state|
|
|
173
173
|
if state[:instance]
|
|
174
174
|
instance_variable_set(name, state[:value])
|
|
@@ -178,14 +178,14 @@ module Is
|
|
|
178
178
|
super
|
|
179
179
|
end
|
|
180
180
|
|
|
181
|
-
def initialize_copy(
|
|
181
|
+
def initialize_copy(...)
|
|
182
182
|
@__defined_state_isolations = []
|
|
183
183
|
|
|
184
184
|
super
|
|
185
185
|
end
|
|
186
186
|
end
|
|
187
187
|
|
|
188
|
-
extends :
|
|
188
|
+
extends :definition, :implementation do
|
|
189
189
|
# [public] Safely mutates state by name, yielding a copy of the current value to the block.
|
|
190
190
|
#
|
|
191
191
|
def mutate_state(name, &block)
|
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
|
+
version: 0.1.1
|
|
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-07-
|
|
11
|
+
date: 2021-07-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: core-copy
|
|
@@ -30,14 +30,14 @@ dependencies:
|
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '0.
|
|
33
|
+
version: '0.3'
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '0.
|
|
40
|
+
version: '0.3'
|
|
41
41
|
description: Easily manage object state.
|
|
42
42
|
email: bryan@metabahn.com
|
|
43
43
|
executables: []
|