core-state 0.1.0 → 0.1.1

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: a830666ebf18447a8c3274d2952173dc3533af6b0321b95e785b3008c58d6ab8
4
- data.tar.gz: f3bd2ec548d47fa6fc9c66fa0dca8f6d1d9ecd721916a3de935827aab6a48805
3
+ metadata.gz: e5ce4cb2ff3e96c75306c312db38fc09e9f95499d2e4d133d48093b38f64423b
4
+ data.tar.gz: 04a0e78d72397976690d10d37431a6765809906a5c1708a7ac504bb20bf2d329
5
5
  SHA512:
6
- metadata.gz: ba61451ed0cc6974c3b2808dfcbd72aa693be05630e77896ac3921deec4c9d3481a5cab7213bc33cf923449bd254babd875458bf3f9940e4c1433ec8ee82048a
7
- data.tar.gz: 0654f08454d2d04e2daca056c08964fc4fc644b70e854208f7cb24e24f00fdb117e37e35856f333692a12653e8fc16d40525c55948de49e31d285022e231f1f7
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*
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Core
4
4
  module State
5
- VERSION = "0.1.0"
5
+ VERSION = "0.1.1"
6
6
 
7
7
  def self.version
8
8
  VERSION
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
- applied do
17
+ applies do
18
18
  prepend_defined_state_modules
19
19
  end
20
20
 
21
- extends :class do
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 :instance, prepend: true do
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 :class, :instance do
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.0
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-07 00:00:00.000000000 Z
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.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.0'
40
+ version: '0.3'
41
41
  description: Easily manage object state.
42
42
  email: bryan@metabahn.com
43
43
  executables: []