dorian-to_struct 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dorian/core_ext/hash/struct.rb +5 -7
- data/lib/dorian/to_struct.rb +2 -0
- data/lib/dorian-to_struct.rb +2 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db03850d03b92fed3cddda6d0e70545b80edc8b7b634db08229c31d76972a3a8
|
4
|
+
data.tar.gz: 4b18f9c555086662520e15b715fe78dd7544929728e469b2aa4df5b4357d13bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 995d22418293d53c30b2a5d98b54886b9f50d8bb44679fd554b508b0edc0242a30a9cff8a153d7cac816d5aeab3645f92ab8c97c3ced0c4c3108ff7a8f04fafe
|
7
|
+
data.tar.gz: 53f7e602ded31ce1c6dd98f0bbb84b0816e132baffeb1dc9c5329cc3c763a70f53124bf9a80663d28a0845be0c96b881e67c09be985e7d888453c243b16cdaf3
|
@@ -17,12 +17,10 @@ class Hash
|
|
17
17
|
# user.events.first.name # => "Party"
|
18
18
|
#
|
19
19
|
def to_deep_struct
|
20
|
-
Struct
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
26
|
-
)
|
20
|
+
Struct.new(*keys.map(&:to_sym)).new(
|
21
|
+
*values.map do |value|
|
22
|
+
value.respond_to?(:to_deep_struct) ? value.to_deep_struct : value
|
23
|
+
end
|
24
|
+
)
|
27
25
|
end
|
28
26
|
end
|
data/lib/dorian/to_struct.rb
CHANGED
data/lib/dorian-to_struct.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dorian-to_struct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dorian Marié
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |-
|
14
14
|
Adds `#to_struct` and `#to_deep_struct` to Hash and Array
|
@@ -23,7 +23,7 @@ files:
|
|
23
23
|
- lib/dorian/core_ext/array/struct.rb
|
24
24
|
- lib/dorian/core_ext/hash/struct.rb
|
25
25
|
- lib/dorian/to_struct.rb
|
26
|
-
homepage: https://github.com/
|
26
|
+
homepage: https://github.com/dorianmariecom/to_struct
|
27
27
|
licenses:
|
28
28
|
- MIT
|
29
29
|
metadata:
|
@@ -43,7 +43,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
43
43
|
- !ruby/object:Gem::Version
|
44
44
|
version: '0'
|
45
45
|
requirements: []
|
46
|
-
rubygems_version: 3.
|
46
|
+
rubygems_version: 3.5.3
|
47
47
|
signing_key:
|
48
48
|
specification_version: 4
|
49
49
|
summary: Adds `#to_struct` and `#to_deep_struct` to Hash and Array
|