l43_open_object 0.5.0 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 59563ce9436ed3a998820c2b36f05e3b488cea636559747c2b83953d6f1fc940
4
- data.tar.gz: 756c5fc1aae48e18e55ed1bf9ec6439d01c83f00248ddaabf87abd4c9cfec307
3
+ metadata.gz: 7f7fc44fb3888a0fd0ba528947c0941aed333c9137a3951cf386d9cf417912a7
4
+ data.tar.gz: edd172d163970f148337fbcdab40f2f0d0021eb5fda9f40fdbb17bc3c43caa37
5
5
  SHA512:
6
- metadata.gz: 847d38dc2b7cd2bb8fe789d08af7176d491f1747ae70c8808941e0a9d875e95892087aa9310fbb254af92d5d05a4703c79213853c3ef250e393781162c7e0c30
7
- data.tar.gz: d12585ca4e5f3666e8796ea0fbf77fac8f32c67912e5c15d40674499f7f7fa6bffbc428186fa5a1a0221e26db0e3d59d553da8bcc500a81758c6f49643900768
6
+ metadata.gz: 884418b5c75ca3161d48fcf79a9b0901b3b2fbfdba7ab31cd96f30b35c408866f8bb623d65e629b831c6f374ce958878ca3b3f0ebd2f3c5496905ca862fada68
7
+ data.tar.gz: b46d6021ccd011e69da8cf319d74cb6807aaadeb79779c4262043d0018394bff4e1ec47f819fb0bf01b1a0bae55c109f58c306ca4f3281e4402a41d849db27f6
@@ -2,7 +2,7 @@
2
2
 
3
3
  module L43
4
4
  module OpenObject
5
- VERSION = "0.5.0"
5
+ VERSION = "0.5.1"
6
6
  end
7
7
  end
8
8
  # SPDX-License-Identifier: AGPL-3.0-or-later
@@ -12,8 +12,8 @@ module L43
12
12
  @__callable_6B9l39xVLR8UnX5U = nil
13
13
  end
14
14
 
15
- def attr(name, default: None, as: None, &blk)
16
- @__atts_6B9l39xVLR8UnX5U.update(name => OpenStruct.new(default:, type: as, constraint: blk))
15
+ def attr(name, default: None, as: None, nullable: false, &blk)
16
+ @__atts_6B9l39xVLR8UnX5U.update(name => OpenStruct.new(default:, type: as, constraint: blk, nullable:))
17
17
  end
18
18
 
19
19
  def make_callable(&blk)
@@ -17,8 +17,10 @@ module L43
17
17
  raise SpuriousAttribute, "the following attributes have not been defined on this class: #{spurious.inspect}"
18
18
  end
19
19
 
20
- def check_type(type, value)
20
+ def check_type(type, value, nullable:)
21
21
  return if None == type
22
+ return if value.nil? && nullable
23
+
22
24
  case type
23
25
  when Array
24
26
  return true unless type.member?(value)
@@ -28,7 +30,7 @@ module L43
28
30
  end
29
31
 
30
32
  def check_value(desc, value)
31
- return :type if check_type(desc.type, value)
33
+ return :type if check_type(desc.type, value, nullable: desc.nullable)
32
34
  case desc.constraint
33
35
  when nil
34
36
  nil
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: l43_open_object
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Dober