core-state 0.1.3 → 0.1.4

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: 1256eb4ef3acf8b61a7754d8ea30ce644f7fc081132a3d9f107a40deca79ed0a
4
- data.tar.gz: f65aa78f287f521a729723823f04339153d0a80cf8291e82e4a1c791cc57745e
3
+ metadata.gz: 7c21289439e5a70015dc1fad5f146ce0742296965b142b7e1a358195a4eeae7e
4
+ data.tar.gz: c02f0889fd523fcb34c865b2dd3232a2bd2bce51c0211bff5f21c14aef848daa
5
5
  SHA512:
6
- metadata.gz: 1669bdf575ac48ed4abb7523383d2a8ae39a6f52fd6b08143b3ef48bd89698e9492f9f16ffff1538329a35989ec57bde2db1b77e2d67e1cafc89bd33896788e4
7
- data.tar.gz: 1cda2c4017dccf2c9e9d9c935d48c95d6aeeda0c471f662d5618b723b54d08d921bae78849e3aa5fd7783716402edbc8d8726a5638c83992e318db45be4c2a27
6
+ metadata.gz: 753c19c8d932f869ab172136b3772e70502969ed4c702317c61de491d2fe52da8b6a6b32a1e5b00b02535e0a46bd0f3d33e62b56fa1862c7e6c2c6803fe3da84
7
+ data.tar.gz: f660e4cc842ef45e30b6ee665af5a4a8aa33de9c170e3852afb8bf4c5cd5fd5cf21b028be78927761e1febd2859655a3257d50e9870345469934a9146e94a534
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [v0.1.4](https://github.com/metabahn/corerb/releases/tag/2021-09-30)
2
+
3
+ *released on 2021-09-30*
4
+
5
+ * `fix` [#85](https://github.com/metabahn/corerb/pull/85) Initialize with class-level state when available ([bryanp](https://github.com/bryanp))
6
+
1
7
  ## [v0.1.3](https://github.com/metabahn/corerb/releases/tag/2021-09-28)
2
8
 
3
9
  *released on 2021-09-28*
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Core
4
4
  module State
5
- VERSION = "0.1.3"
5
+ VERSION = "0.1.4"
6
6
 
7
7
  def self.version
8
8
  VERSION
data/lib/is/stateful.rb CHANGED
@@ -122,6 +122,10 @@ module Is
122
122
  defined_state[ivar_name] = state
123
123
  defined_state_isolations << ivar_name
124
124
 
125
+ if state[:class]
126
+ instance_variable_set(ivar_name, default)
127
+ end
128
+
125
129
  prefix = if private
126
130
  "private "
127
131
  else
@@ -239,9 +243,14 @@ module Is
239
243
 
240
244
  extends :implementation, prepend: true do
241
245
  def initialize(...)
242
- self.class.send(:defined_state).each_pair do |name, state|
246
+ self_class = self.class
247
+ self_class.send(:defined_state).each_pair do |name, state|
243
248
  if state[:instance]
244
- instance_variable_set(name, state[:value])
249
+ if state[:class]
250
+ instance_variable_set(name, self_class.instance_variable_get(name))
251
+ else
252
+ instance_variable_set(name, state[:value])
253
+ end
245
254
  end
246
255
  end
247
256
 
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.3
4
+ version: 0.1.4
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-09-29 00:00:00.000000000 Z
11
+ date: 2021-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: core-extension