dorian-to_struct 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/dorian/to_struct.rb +26 -0
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 350eb6877cc6add5b4ac355d0863bc64d7dd1f22311e61df9d5dc94686ac82db
4
- data.tar.gz: b201457ccb571fcccf5c131cf0bd454eeb35cc52a3a600edde79dbc4cb8803f6
3
+ metadata.gz: d4f5ac19e990aa8f6bf562b7d81cdc16883fe2125f3ca3c49ed5c263fe9ea093
4
+ data.tar.gz: cca57932c680abb611f8607b04cc7c91c95afdb47ed32a13e3758336b6bebf31
5
5
  SHA512:
6
- metadata.gz: 7bb8b46c1de9064a90d801d84ef3cc8e9911738ab8a483b5442fbba93246acb68a3ea0684fede2569a512a11a61e9aac9c005b1b9619356f1ede0f603fd8c957
7
- data.tar.gz: bdc61f968f6d2523aae3092368363a687082e75f6a94074248079e28b32c407b88171c72aa9eaee2694d685f0d10067b81f7c1b760fb8a893db72dbdc6e1e7cf
6
+ metadata.gz: 26b356e92e535b244016df40bb9dc40063797799d0f915bbaaa0e1411d647552dc1ed8ab3081479fbb0ab5e95c138a4a59dd5ef586096ab18630aa05ed0ad782
7
+ data.tar.gz: 87d48e7153fa3343038347bce0a17420d3ab95cf60f9b9ec77f12527cac1322da106b986a640f2c0129336132ae82bfdd31ef435f2b365c681c0084ff8e5a42d
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.1.0
@@ -3,9 +3,27 @@ class Array
3
3
  map(&:to_struct)
4
4
  end
5
5
 
6
+ def from_struct
7
+ map(&:from_struct)
8
+ end
9
+
6
10
  def to_deep_struct
7
11
  map(&:to_deep_struct)
8
12
  end
13
+
14
+ def from_deep_struct
15
+ map(&:from_deep_struct)
16
+ end
17
+ end
18
+
19
+ class Struct
20
+ def from_struct
21
+ to_h
22
+ end
23
+
24
+ def from_deep_struct
25
+ to_h { |key, value| [key, value.from_deep_struct] }
26
+ end
9
27
  end
10
28
 
11
29
  class Hash
@@ -26,4 +44,12 @@ class Object
26
44
  def to_deep_struct
27
45
  self
28
46
  end
47
+
48
+ def from_struct
49
+ self
50
+ end
51
+
52
+ def from_deep_struct
53
+ self
54
+ end
29
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dorian-to_struct
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Marié