vident 0.4.0 → 0.4.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: d1ead61d39ae1b70058a4002d6b3ed7ad4baade0d03ccaa6f2501ba20ac028b5
4
- data.tar.gz: bbebb2b863ee0e1b734dc50c6a03015e0375a28a43004f9f4954c681acd954ca
3
+ metadata.gz: eb36bbcf0d3a46ec51c1a68e80dbf0ef4b85076412591d30215779d1ff2816e8
4
+ data.tar.gz: 6c4b6f98a4ac9bcbebaea4003a6532231a2e188aa94ec34889f4c1c624c9ae46
5
5
  SHA512:
6
- metadata.gz: 1ac922f2933bd655a2aa69ca5fbeb4bb05bb6ac8277a7bb0c7e6a85c6329aebe0dcc63b0fcdf5a03c29b775348044c536d9f460c6006a43b5190418cc47d23f2
7
- data.tar.gz: 26f4db0079c735b6df0fa26aca20e96a564e24d07dca71b6a1396ea95a86993ef8a99209df6bdfd1be618dfa8f6933281e1506318ad2fb592ce42e47b0456ba7
6
+ metadata.gz: 6ccf024bee94cccffccc5b8cf7999b0b1b2e47c1a4185ab2f5a2f5129b7494d66cdde1d7d8ee8364123386dedd3f1f15ae60c27798db73cea3be4f22f68b24f6
7
+ data.tar.gz: f09643a2d324a23012b5466b6bd7ad4a205f21238441891557a8d60d5a71860f5a64e866366bdb63744a62f6d7efed53bdfcb17f5711eab54e35675cefd60f88
@@ -96,12 +96,12 @@ if Gem.loaded_specs.has_key? "dry-struct"
96
96
  options[:delegates] != false
97
97
  end
98
98
 
99
- def define_on_schema(name, type_info, options)
99
+ def define_on_schema(attribute_name, type_info, options)
100
100
  @attribute_ivar_names ||= {}
101
- @attribute_ivar_names[name] = :"@#{name}"
102
- define_attribute_delegate(name) if delegates?(options)
103
- @schema ||= Class.new(Vident::Attributes::TypedNilingStruct)
104
- @schema.attribute name, type_info
101
+ @attribute_ivar_names[attribute_name] = :"@#{attribute_name}"
102
+ define_attribute_delegate(attribute_name) if delegates?(options)
103
+ @schema ||= const_set("TypedSchema", Class.new(Vident::Attributes::TypedNilingStruct))
104
+ @schema.attribute attribute_name, type_info
105
105
  end
106
106
 
107
107
  def define_attribute_delegate(attr_name)
@@ -135,10 +135,9 @@ if Gem.loaded_specs.has_key? "dry-struct"
135
135
  type, subtype = extract_member_type_and_subclass(signature, options)
136
136
  dry_type = dry_type_from_primary_type(type, strict, converter)
137
137
  if subtype && dry_type.respond_to?(:of)
138
+ subtype_info = dry_type_from_primary_type(subtype, strict, converter)
138
139
  # Sub types of collections currently can be nil - this should be an option
139
- dry_type.of(
140
- map_primitive_to_dry_type(subtype, options, converter).optional.meta(required: false)
141
- )
140
+ dry_type.of(subtype_info.optional.meta(required: false))
142
141
  else
143
142
  dry_type
144
143
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Vident
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vident
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Ierodiaconou
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-24 00:00:00.000000000 Z
11
+ date: 2023-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport