type_struct 1.0.0 → 1.1.0

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: bc4c66aaad503a0453e4b093c986f8dd122c0cf3f481fcaecbfbac0d90f0b4bf
4
- data.tar.gz: 22e176748867e33d5ee26087d5d0641ff8ca6326606cd8b3ad6a2a32da0a0a20
3
+ metadata.gz: 5e71eb2d2e7f2cca02978426927745eef8cecc6b3f091f9418009e7b24c2155f
4
+ data.tar.gz: de47a1491a131ade2b3e7978e45008176ab10f514658dce5f05e50f0c7af6c80
5
5
  SHA512:
6
- metadata.gz: dd1c1c47f6ab498addba28013851f30bfa23cefafa9391cfab3a3447f8568ea6cd3a927bb437545adcbccfed6b756632c3bb1030e5188ba4e7caa0b971c79cd8
7
- data.tar.gz: 7bb8bd056e51f0a9acd6b59503e255f15de328a2a552cf49b1d6d5e25440a89a5fb2e0e279ed9e93f46659d2a76f7fd7d388f65ea371b899baaf4738511cb4a3
6
+ metadata.gz: a6fce6b7a938a3aee3f6cee47379243889e8f58b80d2246394e1b629c88956ec1bd162a3afc22f1c9c40faca9562be0cd91b11b07aeb5ccc13a16a8bfed56848
7
+ data.tar.gz: 3909d8b748d66dd266c7ef24e5693fc2965e2816183f4cfb1c52a30f1993996d24fa3550be7d5d515fa12eda06346d24fa301dc49d196730408e9181b949004b
data/README.md CHANGED
@@ -220,7 +220,7 @@ p Baz.from_hash(qux: [1, 2, false, true]) #=> #<A::Baz qux=[1, 2, false, true]>
220
220
 
221
221
  ## Auto Generator
222
222
 
223
- ```json
223
+ ```rb
224
224
  $ echo '{"posts": [{"number":10491,"name":"ksss"}]}' | ruby -r type_struct/generator/json
225
225
  Post = TypeStruct.new(
226
226
  number: Integer,
@@ -17,6 +17,7 @@ class TypeStruct
17
17
  b = e.backtrace_locations.find do |b|
18
18
  b.absolute_path !~ THIS_LIB_REGEXP
19
19
  end
20
+ next unless b&.absolute_path
20
21
  pathname = Pathname.new(b.absolute_path)
21
22
  relative_path = if pathname.absolute? && PWD.absolute?
22
23
  pathname.relative_path_from(PWD)
@@ -1,3 +1,3 @@
1
1
  class TypeStruct
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
data/lib/type_struct.rb CHANGED
@@ -64,7 +64,11 @@ class TypeStruct
64
64
  module ClassMethods
65
65
  def from_hash(arg)
66
66
  unless h = Hash.try_convert(arg)
67
- raise TypeError, "no implicit conversion from #{arg} to Hash"
67
+ begin
68
+ raise TypeError, "no implicit conversion from #{arg} to Hash"
69
+ rescue => e
70
+ raise TypeStruct::MultiTypeError, [e]
71
+ end
68
72
  end
69
73
  args = {}
70
74
  errors = []
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: type_struct
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ksss
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-31 00:00:00.000000000 Z
11
+ date: 2024-04-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Pseudo type system on struct.
14
14
  email:
@@ -49,7 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
49
49
  - !ruby/object:Gem::Version
50
50
  version: '0'
51
51
  requirements: []
52
- rubygems_version: 3.4.10
52
+ rubygems_version: 3.5.3
53
53
  signing_key:
54
54
  specification_version: 4
55
55
  summary: Pseudo type system on struct.