foobara 0.0.22 → 0.0.23

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: dc681307752b396bf7baaf20856fbdf5107da406b112b5c15039ca915859a497
4
- data.tar.gz: d779a8020d0e65156965a9a32c7f8b9f1c0daebbcedb3795917701feb3b7c845
3
+ metadata.gz: 17aca0016743da17a419540e3953855d94ee622a0f331fdc1e3765f02eef8772
4
+ data.tar.gz: f35365045973554ca57d08107dcb645f26406cd70e69598120f234462257074b
5
5
  SHA512:
6
- metadata.gz: fafb15435c334846fdd3f1d233abfbe8a93b02bba7374f91026555fcd7a3fd97b47fa24825a0e72dcafa0ac64688c9accead19c9c44d427ec62c707e70986016
7
- data.tar.gz: 9ff12cb0f19aaf131808200a6196681c9c9ddec9febbf0fae0c7ff008439895243da0cf4cb068cb10bb2a162f58049eb35437aaa777a1724d5a3adf1df6d5f4f
6
+ metadata.gz: 5cad819d5b7aeb1122a31a36f8ba4569d0142454be39030629d8996f60469edc6da2d555ae49c0b8513c011ad0e317de2a6696fee1de807c5c813a19a8b2f07c
7
+ data.tar.gz: ab20a3c72ffa7d0ebb3e921d70bf519d4070ab076ae699743c4600b7e17e9cd1f08d0437dc27a39f141272c6a3d7e0bad824a9cda05f07a3c17b6ff7bdb1d55c
data/CHANGELOG.md CHANGED
@@ -1,6 +1,7 @@
1
- ## [0.0.22] - 2024-12-03
1
+ ## [0.0.23] - 2024-12-03
2
2
 
3
3
  - Allow creating entity types from declaration without model_module
4
+ - Make model classes with an mutable of false have instances that default to immutable
4
5
 
5
6
  ## [0.0.21] - 2024-12-02
6
7
 
@@ -207,8 +207,14 @@ module Foobara
207
207
  end
208
208
  end
209
209
 
210
- # why do we default to true here but false in the transformers?
211
- mutable = options.key?(:mutable) ? options[:mutable] : true
210
+ mutable = if options.key?(:mutable)
211
+ options[:mutable]
212
+ elsif self.class.model_type.declaration_data.key?(:mutable)
213
+ self.class.model_type.declaration_data[:mutable]
214
+ else
215
+ # why do we default to true here but false in the transformers?
216
+ true
217
+ end
212
218
 
213
219
  self.mutable = if mutable.is_a?(::Array)
214
220
  mutable.map(&:to_sym)
@@ -228,7 +234,7 @@ module Foobara
228
234
  def write_attribute(attribute_name, value)
229
235
  attribute_name = attribute_name.to_sym
230
236
 
231
- if mutable == true || mutable&.include?(attribute_name)
237
+ if mutable == true || (mutable != false && mutable&.include?(attribute_name))
232
238
  outcome = cast_attribute(attribute_name, value)
233
239
  attributes[attribute_name] = outcome.success? ? outcome.result : value
234
240
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.22
4
+ version: 0.0.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi